Instead of letting the lock object expire before it unlocks, you can try manually unlocking the mutex in PushMessage() before unlocking the waiting thread, i.e.
void PushMessage(MyMessage m)
Thus, when thread 2 is unlocked, there will be no βcrossβ time when thread 1 contains a lock, and thread 2 tries to get a lock on your mutex. I do not understand why this would create problems, but again, at least you will not have thread 2 trying to call lock.lock() , while thread 1 still contains the lock.
source share