Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Approaches to threading

Author: Daniel Clausen

Date: 00:34:34 06/16/04

Go up one level in this thread


On June 15, 2004 at 23:26:48, Eric Oldre wrote:

>On June 15, 2004 at 19:10:33, Russell Reagan wrote:
>
>>On June 15, 2004 at 18:01:07, Sean Empey wrote:
>>
>>>Since you are writing it in C look at: _beginthread
>>
>>Actually, you should use _beginthreadex() and _endthreadex(). CreateThread()
>>links to the single threaded C run time libraries, while _beginthread() and
>>_beginthreadex() link to the multithreaded C run time libraries. If you know you
>>are using the C run time libraries, you should use _beginthreadex(). If you
>>think you aren't using the C run time libraries, you should still use
>>_beginthreadex(), because it is almost impossible to know for sure that some
>>other library isn't using the C run time library under the hood.
>>_beginthreadex() is to be preferred over _beginthread() because _beginthread()
>>can cause an unrecoverable race condition in some cases. To be safe, use
>>_beginthreadex() and _endthreadex().
>
>Are _beginthreadex() and _endthreadex() portable across platforms as well?
>
>It looks like the behavior is similar to the behavior of CreateThread from the
>documentation I've seen.

If you want something halfway portable, you should use pthreads. (see link
posted by Dann)

If you want to use _beginthread/_beginthreadex stuff though, I would also
recommend using the ex-versions, since the other can't be used in
WaitForSingleObject(). (at least, that's what someone claimed last time I
checked with google)

Sargon



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.