A counting semaphore resembles a mutex in several respects, but there are differences, as
well as reasons to use one resource over the other.
A mutex is exceptionally robust in providing mutual exclusion. If this is crucial to
your application, then using a mutex is a good decision. However, if mutual exclusion is
not a major factor in your application, then use a counting semaphore because it is
slightly faster and uses fewer system resources.
Threadx-Comparison of a mutex with a counting semaphore
最新推荐文章于 2024-03-07 10:53:45 发布