Exemplo n.º 1
0
// master线程等待所有线程初始化完成
void wait_for_thread_init() {
    s_init_lock.Hold();
    while (s_init_count < s_net_setting.net_thread_num_) {
        pthread_cond_wait(&s_init_cond, &s_init_lock.GetMutex());
    }
    s_init_lock.Release();
}
Exemplo n.º 2
0
// worker线程初始化完成后通知master线程
void register_thread_init() {
    s_init_lock.Hold();
    ++s_init_count;
    pthread_cond_signal(&s_init_cond);
    s_init_lock.Release();
}