split to prepare and start due to daemon_init
parent
f3e24601d2
commit
89dd6733b6
|
|
@ -836,9 +836,8 @@ static int sptr_array_alloc_init(void *element, void *args)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sf_connection_manager_start(SFConnectionManager *cm)
|
int sf_connection_manager_prepare(SFConnectionManager *cm)
|
||||||
{
|
{
|
||||||
pthread_t tid;
|
|
||||||
int result;
|
int result;
|
||||||
int element_size;
|
int element_size;
|
||||||
SFCMConnGroupEntry *group;
|
SFCMConnGroupEntry *group;
|
||||||
|
|
@ -871,6 +870,13 @@ int sf_connection_manager_start(SFConnectionManager *cm)
|
||||||
__sync_bool_compare_and_swap(&group->alives, NULL, sptr_array);
|
__sync_bool_compare_and_swap(&group->alives, NULL, sptr_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sf_connection_manager_start(SFConnectionManager *cm)
|
||||||
|
{
|
||||||
|
pthread_t tid;
|
||||||
|
|
||||||
if (cm->alive_detect.bg_thread_enabled) {
|
if (cm->alive_detect.bg_thread_enabled) {
|
||||||
return fc_create_thread(&tid, connection_manager_thread_func,
|
return fc_create_thread(&tid, connection_manager_thread_func,
|
||||||
cm, SF_G_THREAD_STACK_SIZE);
|
cm, SF_G_THREAD_STACK_SIZE);
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,9 @@ static inline int sf_connection_manager_init(SFConnectionManager *cm,
|
||||||
int sf_connection_manager_add(SFConnectionManager *cm, const int group_id,
|
int sf_connection_manager_add(SFConnectionManager *cm, const int group_id,
|
||||||
FCServerInfo **servers, const int count);
|
FCServerInfo **servers, const int count);
|
||||||
|
|
||||||
|
int sf_connection_manager_prepare(SFConnectionManager *cm);
|
||||||
|
|
||||||
|
//start thread
|
||||||
int sf_connection_manager_start(SFConnectionManager *cm);
|
int sf_connection_manager_start(SFConnectionManager *cm);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue