]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
avoid little race
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 14 Apr 2008 16:18:49 +0000 (16:18 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 14 Apr 2008 16:18:49 +0000 (16:18 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8105 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/event_handlers/mod_event_socket/mod_event_socket.c

index 9383cf00966e7a7690e1775d338d9012803554aa..26b0ba84f5e5636ce1a9abab214d37933353f43a 100644 (file)
@@ -852,10 +852,11 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
                        acs->arg = switch_core_strdup(acs->pool, arg);
                }
                acs->bg = 1;
+
                switch_threadattr_create(&thd_attr, acs->pool);
                switch_threadattr_detach_set(thd_attr, 1);
                switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-               switch_thread_create(&thread, thd_attr, api_exec, acs, acs->pool);
+
                if ((uuid_str = switch_event_get_header(event, "job-uuid"))) {
                        switch_copy_string(acs->uuid_str, uuid_str, sizeof(acs->uuid_str));
                } else {
@@ -863,6 +864,8 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
                        switch_uuid_format(acs->uuid_str, &uuid);
                }
                switch_snprintf(reply, reply_len, "+OK Job-UUID: %s", acs->uuid_str);
+
+               switch_thread_create(&thread, thd_attr, api_exec, acs, acs->pool);
                
                return SWITCH_STATUS_SUCCESS;
        } else if (!strncasecmp(cmd, "log", 3)) {