reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
resip::EventStackThread Class Reference

This class creates a thread in which to run one or more SipStacks. More...

#include <EventStackThread.hxx>

Inheritance diagram for resip::EventStackThread:
[legend]

Public Member Functions

 EventStackThread (EventThreadInterruptor &si, FdPollGrp &pollGrp)
 
 EventStackThread (SipStack &stack, EventThreadInterruptor &si, FdPollGrp &pollGrp)
 
virtual ~EventStackThread ()
 
void addStack (SipStack &stack)
 
virtual void thread ()
 
virtual void shutdown ()
 
- Public Member Functions inherited from resip::ThreadIf
 ThreadIf ()
 
virtual ~ThreadIf ()
 
virtual void run ()
 
void join ()
 
void detach ()
 
virtual bool waitForShutdown (int ms) const
 
bool isShutdown () const
 

Protected Member Functions

virtual unsigned int getTimeTillNextProcessMS () const
 
virtual void afterProcess ()
 

Additional Inherited Members

- Public Types inherited from resip::ThreadIf
typedef std::thread::id Id
 
typedef pthread_key_t TlsKey
 
typedef void TlsDestructor(void *)
 
- Static Public Member Functions inherited from resip::ThreadIf
static Id selfId ()
 
static int tlsKeyCreate (TlsKey &key, TlsDestructor *destructor)
 This function follows pthread_key_create() signature.
 
static int tlsKeyDelete (TlsKey key)
 This function follows pthread_key_delete() signature.
 
static int tlsSetValue (TlsKey key, const void *val)
 This function follows pthread_setspecific() signature.
 
static void * tlsGetValue (TlsKey key)
 This function follows pthread_getspecific() signature.
 
- Protected Attributes inherited from resip::ThreadIf
std::shared_ptr< std::thread > mThreadObj
 
Id mId
 
bool mShutdown
 
Mutex mShutdownMutex
 
Condition mShutdownCondition
 

Detailed Description

This class creates a thread in which to run one or more SipStacks.

The thread provides cycles to the stack(s). It provides cycles in 3 ways:

  1. When socket-io is possible, the event-loop will directly invoke the registered callback.
  2. Prior to waiting for events, getTimeTillNextProcessMS() is called on all stacks.
  3. After waiting, processTimers() is called on all stacks.

This implementation improves on StackThread and IntrruptableStackThread, by using the epoll() based system call (if available) provided by the FdPoll class.

Note that this is different than the InterruptableStackThread and simple StackThread in that it doesn't use the buildFdSet()/process() flow.

You must register {si} as an AsyncProcessHandler on the stacks in order to use this class. The same {si} instance must be used for all stacks.

Definition at line 40 of file EventStackThread.hxx.

Constructor & Destructor Documentation

◆ EventStackThread() [1/2]

EventStackThread::EventStackThread ( EventThreadInterruptor &  si,
FdPollGrp &  pollGrp 
)

Definition at line 37 of file EventStackThread.cxx.

◆ EventStackThread() [2/2]

EventStackThread::EventStackThread ( SipStack &  stack,
EventThreadInterruptor &  si,
FdPollGrp &  pollGrp 
)

Definition at line 43 of file EventStackThread.cxx.

◆ ~EventStackThread()

EventStackThread::~EventStackThread ( )
virtual

Definition at line 51 of file EventStackThread.cxx.

Member Function Documentation

◆ addStack()

void EventStackThread::addStack ( SipStack &  stack)

Definition at line 57 of file EventStackThread.cxx.

◆ afterProcess()

void EventStackThread::afterProcess ( )
protectedvirtual

Definition at line 105 of file EventStackThread.cxx.

◆ getTimeTillNextProcessMS()

unsigned int EventStackThread::getTimeTillNextProcessMS ( ) const
protectedvirtual

Definition at line 99 of file EventStackThread.cxx.

◆ shutdown()

void EventStackThread::shutdown ( )
virtual

Reimplemented from resip::ThreadIf.

Definition at line 92 of file EventStackThread.cxx.

◆ thread()

void EventStackThread::thread ( )
virtual

Implements resip::ThreadIf.

Definition at line 63 of file EventStackThread.cxx.


The documentation for this class was generated from the following files: