
Andreas Huber wrote:
Hmm...I was going to use a synchronous machine due to the state access problems I outlined in another message, but now I see that won't work if terminated_ is in cacheable memory and there is no hardware coherence. For my purposes that's probably ok because we'll only run on machines with hardware coherence. Therefore if I understand you correctly, it's ok if different threads calls process_event() as long as the call (and any call to statechart routines) are guarded by mutexes to avoid the non-reentrancy problems.
That'll probably work, given that you use a single mutex to protect scheduler & machine. However, this is rather ugly as you end up locking two mutextes whenever you queue an event.
Does this imply that there's a mutex in state_machine somewhere that gets locked on some operations? That could definitely be problematic and I'll have to take extra care to avoid deadlock. -Dave