Author: Miguel A. Ballicora
Date: 23:41:34 09/25/02
Go up one level in this thread
On September 25, 2002 at 22:20:50, Robert Hyatt wrote:
>On September 25, 2002 at 17:52:19, Miguel A. Ballicora wrote:
>
>>On September 25, 2002 at 07:48:12, Vincent Diepeveen wrote:
>>
>>>Hello,
>>>
>>>I'm looking to a quick alternative for the windows
>>>function WaitForSingleObject();
>>
>>I think that you are looking for
>>pthread_join();
>>
>>That is what I use and it works exactly the same.
>
>
>This is bad for several reasons.
>
>1. It only works for posix threads. Vincent is using plain old heavyweight
>processes (fork()) and not threads. No way to do the join for forked
>processes. It could be done in another way but it would be unbearably slow
>because fork() is _really_ expensive while pthread_create is not.
>
>2. This means threads have to exit. It is singificantly more efficient to
>use a "thread pool" and start the threads once, rather than stopping/starting
>them thousands of times during a search. But again, for Vincent, this is not
>an issue.
VD was very general in his question and did not rule out posix threads. He
mentioned that he wants to use it for an I/O thread. I see no disadvantages
there.
Miguel
>
>
>
>>
>>I use this in windows:
>>
>>static void engine_thread_wait(void)
>>{
>> WaitForSingleObject (Engine_ID, INFINITE);
>>}
>>
>>And the equivalent in Linux:
>>
>>static void engine_thread_wait(void)
>>{
>> void *p;
>> pthread_join (Engine_ID, &p);
>>}
>>
>>Regards,
>>Miguel
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.