Beispiel #1
0
void cb(SB_Phandle_Type *, struct MS_Mon_NewProcess_Notice_def *msg) {
    int status;

#ifdef SQ_PHANDLE_VERIFIER
    srv_verifier = msg->verifier;
#else
    msg = msg; // touch
#endif
    status = cv.signal();
    assert(status == 0);
}
Beispiel #2
0
void cb(SB_Phandle_Type *, struct MS_Mon_NewProcess_Notice_def *msg) {
    printf("client received new process message, ferr=%d, nid=%d, pid=%d, tag=0x%llx, pname=%s\n",
           msg->ferr,
           msg->nid,
           msg->pid,
           msg->tag,
           msg->process_name);
    assert(msg->ferr == XZFIL_ERR_OK);
    assert(msg->tag == server_inx);
    cv.signal(true);
    server_inx++;
}
Beispiel #3
0
//
// wait for TIMER_SIG and process timer-list
//
void SB_Timer_Thread::run() {
    const char          *WHERE = "SB_Timer_Thread::run";
    int                  lv_err;
    int                  lv_sig;
    sigset_t             lv_set;
    int                  lv_status;

    if (gv_ms_trace_timer)
        trace_where_printf(WHERE, "timer sig thread started\n");

    iv_running = true;
    iv_cv.signal(true); // need lock

    sigemptyset(&lv_set);
    sigaddset(&lv_set, TIMER_SIG);
    while (!iv_shutdown) {
        lv_err = sigwait(&lv_set, &lv_sig);
        SB_util_assert_ieq(lv_err, 0);
        if (gv_ms_trace_timer)
            trace_where_printf(WHERE, "sigwait returned sig=%d\n", lv_sig);

        if (iv_shutdown)
            break;
        if (lv_sig != TIMER_SIG)
            continue;

        lv_status = gv_timer_mutex.lock();
        SB_util_assert_ieq(lv_status, 0);

        sb_timer_timer_list_complete(WHERE);

        if (gp_timer_head != NULL) {
            if (gv_ms_trace_timer)
                sb_timer_timer_list_print();
            for (;;) {
                if (gp_timer_head == NULL)
                    break;
                // restart timer
                if (sb_timer_setitimer(WHERE, gp_timer_head->iv_to))
                    break;
                sb_timer_timer_list_complete(WHERE);
            }
        }
        lv_status = gv_timer_mutex.unlock();
        SB_util_assert_ieq(lv_status, 0);
    }
    if (gv_ms_trace_timer)
        trace_where_printf(WHERE, "EXITING timer sig thread\n");
    iv_running = false;
}