HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
SIP Stack Threading Model 41
5
SIP STACK THREADING MODEL
MULTITHREADING
M
ODES
The SIP Stack can work in one of three threading modes:
No-threads mode—both the SIP Stack and the application
work on the same single thread and therefore there is no need to
protect the SIP Stack objects with locks. To avoid object
locking, you need to set RV_THREADNESS_TYPE to
RV_THREADNESS_SINGLE in the rvusrcongif.h file found
in the common/config directory.
Threadsafe mode—the SIP Stack is not multithreaded but the
application is. Therefore the SIP Stack protects its objects using
locks. In this mode, the numberOfProcessingThreads
configuration parameter is set to zero and the
RV_THREADNESS_TYPE should be set to
RV_THREADNESS_MULTI.
Multithreaded mode—the SIP Stack works with one main
thread and several processing threads. All SIP Stack objects are
protected by locks.
MULTITHREADED MODE This chapter focuses on the multithreaded mode of the SIP Stack. To work in
multithreaded mode, the application should set the numberOfProcessingThreads
configuration parameter to a value bigger than zero, and set the
RV_THREADNESS_TYPE to RV_THREADNESS_MULTI. When working
in multithreaded mode, the main thread waits for incoming events (it sits on the
select loop). When an event arrives, the main thread inserts the event into a
processing queue and notifies the processing threads that an event is waiting in
the queue. One of the processing threads will take this event from the queue and