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

[reSIProcate] Multi-threaded Stack


Can anybody help me understand running the stack in multithreaded mode. I've
been unable to find any of the samples running in multithreaded mode. All
the samples work fine for me singlethreaded. I'm using the BasicCall sample
and have changed the DialogUsageManager/SipStack to be multithreaded as
follows:

      std::auto_ptr<SipStack> sipStack(new SipStack(true));
      DialogUsageManager* dumUas = new DialogUsageManager(sipStack);

I've also read the following comments in the DialogUsageManager.hxx:

     // Runs the SipStack in its own StackThread. call process() from the
application
      void run();

      // Call this version of process if you are running the sipstack in its
own
      // thread. you must call run() before calling process()
      bool process();

      // Call this version of process if you want to run the stack in the
      // application's thread
      void process(FdSet& fdset);

In the sample the client sends on OPTION message request and the server
replies with a response. When running this in multithreaded I can see that
the transport layer does receive the message but the
ServerOutOfDialogReq::answerOptions callback does not get triggered and
therefore no response message is sent back to the client.

Also, I dont understand why it says "Call this version of process if you are
running the sipstack in its own
      // thread. you must call run() before calling process()"
      bool process();

If running multithreaded why do we need to call process()? Shouldn't the
thread simply run and process the message on its, own and invoke the
callback and therefore send the response?

Thanks in advance!