Search code examples
c++ace

Does ACE_Mutex use spin lock?


Some systems have pretty smart mutex locks that spin in-process for a bit before grabbing a lock from the OS. If your system has such a mutex there's not much point concerning yourself about writing an in-process mutex type.

But not all systems do.

Does ACE take care of this uncertainty for us? I couldn't find it stated in the docs...


Solution

  • It depends upon the underlying platform and config.

    For example ACE_Thread_Mutex uses a CRITICAL_SECTION on Win32: 5.7.7. Other unix versions can use a pthread_mutex. Look into what USYNC_THREAD goes to on your platform.