Computer Chess Club Archives




Subject: gcc / cygwin threads revisited

Author: James Swafford

Date: 14:19:31 07/24/99

I posted a question several days ago about the gcc
equivalent to MSVC's "beginthread( )" .

Bob replied with "fork( )", which does the job, but
there's one rather ugly side effect:  the program
won't terminate.

To be more specific, when I type "quit", the user
thread parses the input and processes it, but for
some reason when the call to exit( ) is performed,
the whole process freezes.  The same thing happens
when executing "return" from main( ).

This doesn't happen when the program is running test
suites, simply because the UIThread( ) is never started.
When the suite is complete, the program exits cleanly.

Perhaps threads are handled differently than with MSVC.
Is it okay to call exit( ) from within UIThread( )?
Would it be better to have UIThread( ) return some variable
indicating the program should terminate, then somehow kill
the thread, then call exit( ) from the "main thread"?  If so,
how do I kill a thread with gcc / cygwin?


This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.