static void teardown_pipes (signal_info** signals, int count) { int i; for (i = 0; i < count; ++i) { signal_info* h = signals [i]; if (mph_int_dec_test (&h->pipecnt)) { if (h->read_fd != 0) close (h->read_fd); if (h->write_fd != 0) close (h->write_fd); h->read_fd = 0; h->write_fd = 0; } } }
// Cleanup a signal_info after waiting for signal static void teardown_pipes (signal_info** signals, int count) { int i; for (i = 0; i < count; ++i) { signal_info* h = signals [i]; if (mph_int_dec_test (&h->pipecnt)) { // Final listener for this signal_info acquire_pipelock_teardown (&h->pipelock); int read_fd = mph_int_get (&h->read_fd); int write_fd = mph_int_get (&h->write_fd); if (read_fd != 0) close (read_fd); if (write_fd != 0) close (write_fd); mph_int_set (&h->read_fd, 0); mph_int_set (&h->write_fd, 0); release_pipelock_teardown (&h->pipelock); } } }