< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index Next in Thread >

Re: [reSIProcate-users] clientSubscription NOTIFY problem


FYI - it is safe to call DialogUsageManager::post() from any thread.

Scott

On Fri, Jun 25, 2010 at 2:26 PM, Scott Godin <sgodin@xxxxxxxxxxxxxxx> wrote:
... inline...

On Fri, Jun 25, 2010 at 2:19 PM, Klaus Darilion <klaus.mailinglists@xxxxxxxxx> wrote:
Hi Scott!

I just modified the basicRegister example to start a DumThread and a InterruptableStackThread. I have removed all stack.process(fdset) and clientDum.process() calls and it still works fine.

>From the application, I still call DUM methods, e.g.

  SharedPtr<SipMessage> regMessage = clientDum.makeRegistration(userAor);
  clientDum.send( regMessage );

just as before.

The Wiki mentions that the application may need to provide its own mutex to protect access to DUM. Is this only needed when the application itself is multithreaded or also if the application is just single threaded?

You cannot call any DUM API's from a thread that is different from the thread calling process.  So in your case (using DumThread) you still need to protect calls to DUM.
 
For example, although the application is single threaded, what happens if DUM calls my ClientRegistrationHandler and I call some DUM methods from within the Handler (which might happen at the same time the application calls some DUM methods)?

The callbacks themselves are running in the DumThread, so it is safe to call other DUM methods from the callbacks, since they will be called in the single DumThread.  However, you cannot call the DUM methods outside of these callbacks without protecting them, or queueing commands to the DUM FIFO.

Scott
 

Thanks
Klaus

Am 09.06.2010 18:00, schrieb Scott Godin:
There is no "out-of-box" threading class that will handle both the stack
and dum - but it shouldn't be hard to create on if you like.  Otherwise,
you will need both DumThread and InterruptableStackThread.

Scott

On Wed, Jun 9, 2010 at 11:54 AM, Klaus Darilion
<klaus.mailinglists@xxxxxxxxx <mailto:klaus.mailinglists@xxxxxxxxx>> wrote:

   Hi Scott!


   Am 08.06.2010 19:32, schrieb Scott Godin:

           Further, is there a mode to let stack/dum create a thread
       itself for

           internal processing (so that I do not need an event loop in the
           application, but wait for callback events)?


       There is a pretty detailed wiki page on all this stuff:
       http://www.resiprocate.org/DUM_Threading


   Not sure if I got it right: I do not care about if dum and stack use
   the same thread or a different one  - I just want that all the SIP
   stuff is happening asynchronously independent from the application's
   thread.

   Will using DumThread solve my issues or do I have to use StackThread
   (or InterruptableStackThread) too?

   Thanks
   Klaus