On 13 Aug 2013, at 13:22, Jan Kiszka wrote: > With tweaking I mean: > > bool aio_poll(AioContext *ctx, bool blocking, > void (*blocking_cb)(bool, void *), > void *blocking_cb_opaque); > > i.e. adding a callback that aio_poll will invoke before and right after > waiting for events/timeouts. This allows to drop/reacquire locks that > protect data structures used both by the timer thread and other threads > running the device model.
That's interesting. I didn't give a huge amount of thought to thread extensibility (not least as the locking needed fixing first), but the model I had in my head was not that the locks were taken on exit from qemu_poll_ns and released on entry to it, but rather that the individual dispatch functions and timer functions called only took whatever locks they needed as and when they needed them. IE everything would already be unlocked prior to calling qemu_poll_ns. I suppose both would work. -- Alex Bligh