线程可以成为免费互斥锁的所有者吗? [英] Can a thread be the owner of a FREE mutex?

查看:62
本文介绍了线程可以成为免费互斥锁的所有者吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我从windbg获得以下输出:

I get the following output from windbg:

 

 

0:023> !handle 1d66c f

0:023> !handle 1d66c f

手柄0001d66c

Handle 0001d66c

 键入        突变

  Type         Mutant

 属性  0

  Attributes   0

   GrantedAccess 0x1f0001:

  GrantedAccess 0x1f0001:

        删除,ReadControl,WriteDac,WriteOwner,Synch

         Delete,ReadControl,WriteDac,WriteOwner,Synch

         QueryState

         QueryState

 &HandleCount  18

  HandleCount   18

 &PointerCount 21

  PointerCount 21

 名称        \ BaseNamedObjects \ SHAR ...

  Name         \BaseNamedObjects\SHAR...

  对象特定信息

  Object specific information

     Mutex是免费的

    Mutex is Free

    突变所有者1498.20e8

    Mutant Owner 1498.20e8

 

这正确吗?

 

 

谢谢

博格丹

 

推荐答案

     Mutex是免费的

    Mutex is Free

    突变所有者1498.20e8

    Mutant Owner 1498.20e8

这正确吗?

我很困惑.我从概念上假设,如果线程释放互斥锁,则它可以保持所有者"身份.如果没有其他线程在互斥体上等待,并且仅当另一个线程试图获取它时才转移所有权. 理解WinDbg的输出.最终,我认为从行为角度来看,这并不重要.

I share your confusion. I suppose conceptually that, if a thread releases the mutex that it could remain the "owner" if there is no other thread waiting on the mutex and that ownership is only transferred when another thread tries to acquire it, then it would make sense of the WinDbg output. Ultimately I don't think it really matters behaviour-wise.


这篇关于线程可以成为免费互斥锁的所有者吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆