From: Cuong N. <cu...@ya...> - 2011-10-20 12:45:27
|
Hi All, I have a process A that creates a thread to do logging, then forks another process B. How do I get B to terminate any existing inherited threads such as the logging thread. Using the "server.c" as an example, where flush_acclog_buffer() is running in a thread, is there something cleaner than than: int IAmSpartacus = 1; ... IAmSpartacus = 0; if (fork() > 0) { IAmSpartacus = 1; } ... static void *flush_acclog_buffer(void *arg) { for ( ; IAmSpartacus == 1 ; ) { st_sleep(ACCLOG_FLUSH_INTERVAL); logbuf_flush(); } return NULL; } |