diff options
Diffstat (limited to 'src/nSocket/nstack')
-rw-r--r-- | src/nSocket/nstack/event/select/nstack_select.c | 22 | ||||
-rw-r--r-- | src/nSocket/nstack/nstack.c | 2 | ||||
-rw-r--r-- | src/nSocket/nstack/nstack_module.c | 20 | ||||
-rw-r--r-- | src/nSocket/nstack/nstack_module.h | 1 | ||||
-rw-r--r-- | src/nSocket/nstack/nstack_socket.c | 2 |
5 files changed, 46 insertions, 1 deletions
diff --git a/src/nSocket/nstack/event/select/nstack_select.c b/src/nSocket/nstack/event/select/nstack_select.c index ba64cff..930f1db 100644 --- a/src/nSocket/nstack/event/select/nstack_select.c +++ b/src/nSocket/nstack/event/select/nstack_select.c @@ -753,4 +753,26 @@ nssct_set_index (i32 fd, i32 inx) select_set_index (fd, inx); } +i32 +select_module_init_child () +{ + pthread_t select_thread_id; + i32 retval; + + if (pthread_create (&select_thread_id, NULL, nstack_select_thread, NULL)) + { + goto ERR_RET; + } + + retval = pthread_setname_np (select_thread_id, "nstack_select_child"); + if (retval) + { + /*set thread name failed */ + } + return TRUE; + +ERR_RET: + return FALSE; +} + #endif /* NSTACK_SELECT_MODULE */ diff --git a/src/nSocket/nstack/nstack.c b/src/nSocket/nstack/nstack.c index 6644e86..4198266 100644 --- a/src/nSocket/nstack/nstack.c +++ b/src/nSocket/nstack/nstack.c @@ -588,7 +588,7 @@ nstack_for_epoll_init () NSSOC_LOGINF ("fork]g_nStackInfo.pid=%u,getpid=%d", g_nStackInfo.pid, getpid ()); - nstack_stack_module_init(); + nstack_stack_module_init_child(); } return 0; } diff --git a/src/nSocket/nstack/nstack_module.c b/src/nSocket/nstack/nstack_module.c index bef91e5..9566ab8 100644 --- a/src/nSocket/nstack/nstack_module.c +++ b/src/nSocket/nstack/nstack_module.c @@ -265,3 +265,23 @@ nstack_stack_module_init () } return 0; } + +int +nstack_stack_module_init_child () +{ + ns_uint32 idx; + for (idx = 0; idx < g_module_num; idx++) + { + if (g_nstack_modules.modules[idx].mops.extern_ops.module_init_child) + { + if (0 != + g_nstack_modules.modules[idx].mops. + extern_ops.module_init_child ()) + { + NSSOC_LOGERR ("nstack[%s] modx:%d init child fail", + g_nstack_modules.modules[idx].modulename, idx); + } + } + } + return 0; +} diff --git a/src/nSocket/nstack/nstack_module.h b/src/nSocket/nstack/nstack_module.h index e0105af..ec81ac1 100644 --- a/src/nSocket/nstack/nstack_module.h +++ b/src/nSocket/nstack/nstack_module.h @@ -135,6 +135,7 @@ extern nstack_module_keys g_nstack_module_desc[]; for ((modInx) = 0; ((modInx) < nstack_get_modNum() && (pMod = nstack_get_module((modInx)))); (modInx)++) int nstack_stack_module_init (); +int nstack_stack_module_init_child (); int nstack_get_deploy_type (); diff --git a/src/nSocket/nstack/nstack_socket.c b/src/nSocket/nstack/nstack_socket.c index e3da248..cd1557b 100644 --- a/src/nSocket/nstack/nstack_socket.c +++ b/src/nSocket/nstack/nstack_socket.c @@ -2775,6 +2775,8 @@ nstack_fork (void) dmm_spinlock_lock_with_pid (nstack_get_fork_share_lock (), get_sys_pid ()); nsep_fork_child_proc (parent_pid); + + (void) select_module_init_child (); common_mem_spinlock_unlock (nstack_get_fork_share_lock ()); } else if (pid > 0) |