static void terminate_chld() { int i; for(i=0; i<wglobal.n_children; i++){ if(wglobal.children[i]!=0) kill(wglobal.children[i], SIGTERM); } if(wait_exit()) return; if(wglobal.children[i]!=0) kill(wglobal.children[i], SIGKILL); wait_exit(); }
void _close(struct socket *sock) { if (!sock) return; /* * Maybe _close() is called in interrupt signal handler, * in which case there is no method to notify app the interrupt. * If sock is waited on recv/accept, we wake it up first! */ wait_exit(&sock->sleep); free_socket(sock); }
int main() { CassCluster* cluster = create_cluster(); CassSession* session = cass_session_new(); uuid_gen = cass_uuid_gen_new(); uv_mutex_init(&mutex); uv_cond_init(&cond); connect_session(session, cluster, on_session_connect); /* Code running in parallel with queries */ wait_exit(); uv_cond_destroy(&cond); uv_mutex_destroy(&mutex); cass_cluster_free(cluster); cass_uuid_gen_free(uuid_gen); cass_session_free(session); return 0; }