[pjsip] Question about stream.c

Michael Broughton Michael_Broughton at advanis.ca
Fri Feb 15 16:58:11 EST 2008


Benny Prijono wrote:
> 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.
>
>   

Well, it is looping while trying to acquire a lock... so if it has a 
reference to the flag, it can just check it on each iteration before the 
timeout is reached.

>>  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...
>   

Destroy requests only happen from my main thread and possibly a SIP 
worker thread. Sorry if I was unclear about this.

The problem is that in rare situations I receive DTMF events and try to 
drop a call at the same time.


-- 
Michael Broughton, Advanis

Unintended Recipient & Unauthorized Use of E-Mail:
This message and attachments may contain confidential or privileged
information that is intended only for the named recipient of this
e-mail. Any unauthorized use or distribution is not permitted. If you
have received this e-mail in error, deleting the e-mail and notifying
the sender would be appreciated. Thank you.





More information about the pjsip mailing list