On 2/14/08, Michael Broughton <Michael_Broughton at advanis.ca> wrote: > > Yes I am trying very hard to minimize my local changes. > > The idea is to have pjmedia_stream_destroy flips a flag somewhere to > indicate that it is attempting to destroy a stream. In my local patch, > the flag is a member of the stream structure. Then the DTMF callback can > check this flag while it is trying to acquire the call lock. > > The benefit of this is that the DTMF callback can fail gracefully > without waiting for a soft deadlock. The flag essentially gives it an > early warning that a soft deadlock is going to occur. > Wouldn't this still be prone to some race condition? The on_dtmf() callback might get the variable before the destroy thread sets it. > Do you think it would be possible to do something like this without > touching pjmedia? Could this be done in PJSUA? I have a feeling that > this would be the only clean way to implement this. > The only clean solution that I could think of is to post the destroy request to main thread. But you've said that you didn't like this one, so... cheers, -benny