ACE学习(四)ACE_Recursive_Thread_Mutex与ACE_RW_Thread_Mutex

ACE_Recursive_Thread_Mutex与ACE_RW_Thread_Mutex


1.不同平台使用有差异性

/**
 * @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.
 */

ACE的ACE_Thread_Mutex互斥锁在windows平台上是可重入的,而在Linux平台上是不可重入的,原因上面也有说明Windows下是使用Critical Section实现的,而Critical Section在window下是可递归的。Linux下的pthread_mutex_t锁默认(USYNC_THREADÿ

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值