DUM Threading

From reSIProcate
Revision as of 18:17, 15 June 2005 by Sgodin (talk | contribs) (restored Thread Safety stuff - removed info on Transport Threads)
Jump to navigation Jump to search

The Dialog Usage Manager (DUM) supports a few threading options - which are summarized below.

NOTE: There is no threading protection in the DUM methods themseleves. If your application itself is multi-threaded you MUST provide your own protection if you plan on calling dum->process and/or other DUM API's from different threads.

Single Threaded

Your application, DUM, the stack and transports all run in the same thread. This is how the BasicCall sample works. A process loop is required:

  while (!dumShutDown)
     FdSet fdset;
     int err = fdset.selectMilliSeconds(stack->getTimeTillNextProcessMS());
     assert ( err != -1 );

Separate Stack Thread

Your application and DUM run in the same thread, the stack and transports run in another thread. To run in this mode you must use or emulate the functionality in StackThread.cxx to startup and run the stack thread. Then you must periodically call the dum->process() method from your application so that DUM can peform its processing. The important thing to remember here, is that DUM is not part of the core stack, it sits on top.

Separate DUM and/or Stack Threads

A class called DumThread is in the works. This will allow you to run all of resiprocate in it's own thread (or threads) and your application in another thread.