1

I have a question regarding synchronization using mutex in ACE framework. Task A has been registered with a Timer Handler. In Task A function foo is called. A Critical Section in foo is protected using recursive mutexes. The variables that are used by foo function ,are used (write/read) acces by handle_timeout. That means that we need to protect them.

We have the following piece of pseudocode

foo()
lock(recursive_mutex)
C.S
unlock(recursive_mutex)

handle_timeout()
{
lock(recursive_mutex)
C.S
unlock(recursive_mutex)
}

If the handle_timeout takes place before foo release the lock, will a deadlock take place?

If we have a Task B with a highest priority that is registered with an other event. If this event fired when the handle_timoeout ,what will happen? Will we have a context switch and the second evcent start processing?

Matthew Verstraete
  • 6,335
  • 22
  • 67
  • 123
getsoubl
  • 808
  • 10
  • 25

0 Answers0