Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: offtopic multithreading question

Author: Robert Hyatt

Date: 22:12:39 07/20/99

Go up one level in this thread


On July 21, 1999 at 01:06:03, James Swafford wrote:

>
>I'm nearly done porting my code to CygWin.
>In MSVC, I started a thread with a call to "beginthread( )"
>in my main( ) function:
>
>   // start ui thread
>   beginthread(UIThread,0,0);
>
>Can anyone tell me how to begin a thread in gcc?
>More specifically, I need to start a thread to execute
>the function: void UIThread(void*);
>
>Help is greatly appreciated.
>
>--
>James


try this:

  if (!fork()) {UITHREAD();exit(0);}

that will spawn a new process, and send it to UITHREAD() to execute. Should
that function return, that thread will exit.

this is 'stock unix' stuff...  I'm not certain it will work under windows even
if you use GCC...  but it certainly works on unix systems...

Bob



This page took 0 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.