The easiest way to do this is:
if (!fork()) {
// We’re in the new thread
doNewThreadStuff();
exit(0);
}
// We’re in the old thread. Continue on.
See also pthread. There’s a good description of it at techpubs.sgi.com.
—
Sheldon Linker
Linker Systems, Inc.
www.linkersystems.com
sol@linker.com
800-315-1174
+1-949-552-1904 from outside North America
Discuss This Question: