Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Keep running after main function returns.

Name: Anonymous 2007-11-01 8:32

In case of event driven programs, i usually don't want to do anything in the main thread (except init, and start the other threads ofc). The problem is, that the program exits when the main function ends.

I usually do a while(true) Sleep() to make the main function go on forever, but that's not quite... elegant. Is there a proper solution for this problem?

Name: Anonymous 2007-11-01 8:37

pthread_join (or equivalent operation) the other threads before returning. This will block the main thread until all other threads die.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List