1

Well, I was just trying to port some code from a WIN32 application to a multiplatform application using boost. Everything was going smoothly until I hit the "WaitForMultipleObjects" problem. Basically, I have a few different boost::recursive_mutexes that need to be grabbed at once. WaitForMultipleObjects grabs them when they are ready, regardless of order.

This has been a bit of missing functionality for quite a while now, as is stated in this thread:

WaitForMultipleObjects functionality in Boost

Anyone find any solutions to the problem since then?

Community
  • 1
  • 1
IdeaHat
  • 7,641
  • 1
  • 22
  • 53
  • IIRC, to avoid deadlock risks, you really should have a partial mutex order. Unordered mutexes can be grabbed in any order since they can't deadlock, ordered mutexes can always be grabbed in the same order. With that scheme, you don't need to take multiple mutexes at once. – MSalters Jul 25 '13 at 14:00
  • @MSalters the design is such that I'm synchronizing two "unrelated" objects: as such, there is not a risk of them deadlocking each other (they each use their own threads, and do not meet until this call). However, I do want the latency of the call to be as small as possible. Sequentially getting these mutexes (i.e. a for each loop) stacks the latency of getting each of these mutexes on top of each other, while not caring the order does not. – IdeaHat Jul 25 '13 at 14:17

0 Answers0