void wsvc_cron_cb(void* arg) { /* perform cronned operation */ verbose(VERB_ALGO, "cron timer callback"); if(cron_thread == NULL) { /* create new thread to do it */ ub_thread_create(&cron_thread, win_do_cron, arg); } /* reschedule */ set_cron_timer(); }
void wsvc_setup_worker(struct worker* worker) { /* if not started with -w service, do nothing */ if(!service_stop_event) return; if(!winsock_register_wsaevent(comm_base_internal(worker->base), &service_stop_ev, service_stop_event, &worker_win_stop_cb, worker)) { fatal_exit("could not register wsaevent"); return; } if(!service_cron) { service_cron = comm_timer_create(worker->base, wsvc_cron_cb, worker); if(!service_cron) fatal_exit("could not create cron timer"); set_cron_timer(); } }