信号 [英] Semaphore

查看:90
本文介绍了信号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


除了Mutex是Binary还是Semaphore是计数器之外,WinCE中的Mutex和Semaphore之间是否存在任何差异?优先级继承不适用于信号量,信号量没有与之关联的特定所有者。


这是什么概念?我要求两名司机使用相同的tranceiver。因此,当任何应用程序关闭一个驱动程序时,我想检查其他驱动程序是否需要它。对于这个要求我可以使用信号量还是只需要使用互斥量?


问候,


GSR

解决方案

互斥锁 有两种状态:发信号/未发信号,这意味着它拥有/不拥有。


当您使用 bInitialOwner = TRUE在命名的互斥锁上调用CreateMutex时你创建(或打开它已经存在)一个请求立即所有权的互斥锁:如果这成功,任何其他想要获取互斥锁的线程必须等到你调用
ReleaseMutex


 


Hi,

Are there any differences between Mutex and Semaphore in WinCE apart from Mutex is Binary and Semaphore is a counting one? and Priority inheritance does not apply to semaphores, which do not have a specific owner associated with them.

What is this owner concept? I have a requirement that two drivers are using the same tranceiver. So, while any application closes one driver I want to check if the other driver need it. For this requirement can I use Semaphore or do I need to use Mutex only?

Regards,

GSR

解决方案

A mutex  has two states: signaled / not signaled which means that it's owned/not owned.

When you call CreateMutex on a named mutex with bInitialOwner = TRUE you create (or open of it already exist) a mutex requesting immediate ownership: if this succeeds any other thread which want to grab the mutex must wait until you call ReleaseMutex

 


这篇关于信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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