感謝您的回復(fù)
的確太低級別了,這是我對操作系統(tǒng)不熟悉造成的.
有的操作系統(tǒng),如win32,系統(tǒng)默認(rèn)實(shí)現(xiàn)的是遞歸鎖,有的則不是,如Solaris.
下面是取自ace注釋
/**
* @class ACE_Thread_Mutex
*
* @brief ACE_Thread_Mutex wrapper (only valid for threads in the same
* process).
*
* This implementation is optimized for locking threads that are
* in the same process. It maps to <CRITICAL_SECTION>s on NT
* and <ACE_mutex_t> with <type> set to <USYNC_THREAD> on UNIX.
* ACE_Thread_Mutex is recursive on some platforms (like
* Win32). However, on most platforms (like Solaris) it is not
* recursive. To be totally safe and portable, developers
* should use ACE_Recursive_Thread_Mutex when they need a
* recursive mutex.
*/
?