Author: Robert Hyatt
Date: 16:48:50 11/18/04
Go up one level in this thread
On November 18, 2004 at 07:36:58, Daniel Shawul wrote:
>i have made a wrapper class for the lock/unlock operations
>that i do at a struct SPLIT.
>SPLIT
>{
> //HANDLE lock;
> CRITICAL_SECTION cs;
> other data...
>}
> At codeguru site i read that critical sections are faster than
>mutexes.But for me they are *very very slower*. I am sure i am doing something
>wrong but don't know what?
>Another question is how profitable is using methods like InterLockedExchange,
>i mean going low level, for SMP chess engines?
If you are going to use the above kind of mutex-locks, you had better not be
using them very often. They will kill your performance. Much better is a
simple spinlock as I use in Crafty.
>
>SPLIT::SPLIT()
>{
> //lock = CreateMutex(NULL,0,NULL);
> InitializeCriticalSection(& cs);
>}
>SPLIT::~SPLIT()
>{
> //CloseHandle();
> DeleteCriticalSection(& cs);
>}
>SPLIT::Lock()
>{
> //WaitForSingleObject(lock,INFINITE);
> EnterCriticalSection(& cs);
>}
>SPLIT::UnLock()
>{
> //ReleaseMutex(lock);
> LeaveCriticalSection(& cs);
>}
>
>best
>daniel
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.