Computer Chess Club Archives


Search

Terms

Messages

Subject: new questions

Author: Daniel Shawul

Date: 04:36:58 11/18/04

Go up one level in this thread


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?

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.02 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.