On Sunday 18 February 2007 12:35 pm, Frank Mori Hess wrote:
That's interesting, I hadn't considered dropping the slot lock before running the slot. It would eliminate the possibility of lock-ordering problems with mutexs in the slot/client code. The slot mutex is really just to protect the disconnect and block operations, so by the time the slot is about to be run all we really need to worry about is that the slot function doesn't get deleted while it is executing. I think I could just drop the slot mutex in the slot iterator dereference operation, after either copying the slot function or using some shared_ptr magic to keep it alive, and all would be well.
It turns out shared_ptr magic was already insuring the slot function would not be deleted, so it was just a 1 line change to drop the slot lock before running the slot (in sandbox cvs now). It is now possible for the same slot to be simultaneously executing in multiple threads, but I don't think that violates our design requirements does it? -- Frank