Terminate threads

Cuong Nguyen <[email protected]> Thu, 20 Oct 2011 05:45:18 -0700 (PDT)
Newsgroups gmane.comp.lib.state-threads.user
Message-ID <[email protected]>
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 logg=
ing thread.

Using the "server.c" as an example, where=A0flush_acclog_buffer() =A0is run=
ning in a thread,=A0is there something cleaner than than:

int IAmSpartacus =3D 1;

...
IAmSpartacus =3D 0;
if (fork() > 0) {
=A0 =A0IAmSpartacus =3D 1;
}
...


static void *flush_acclog_buffer(void *arg)
{
=A0 =A0 for ( ; IAmSpartacus =3D=3D 1 ; ) {
st_sleep(ACCLOG_FLUSH_INTERVAL);
logbuf_flush();
=A0 =A0 }
=A0 =A0 return NULL;

}

---------------------------------------------------------------------------=
---
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Ciosco Self-Assessment and learn =

about Cisco certifications, training, and career opportunities. =

http://p.sf.net/sfu/cisco-dev2dev