[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ccrtp-devel] SingleRTPSessionPool is not thread safe.

From: Jörgen Terner
Subject: [Ccrtp-devel] SingleRTPSessionPool is not thread safe.
Date: Wed, 15 Mar 2006 11:42:17 +0100

Hi all!

I've tried to use the SingleRTPSessionPool. After several crashes I realized 
that it is not thread safe. Insertions and deletions are safe but the main loop 
is not! There is little point in protecting insertions and deletions if the 
code that reads the list is not protected.

I've modified the pool-class so that it seems to work but because the number of 
concurrent sessions are quite large (Minimum requirement ~500) the thread that 
serves the list of sessions is not given enough time to to its job. I've tried 
to increase the thread priority but still, the sessions are not served fast 

My current implementation instead inserts "session-jobs" into a thread pool 
with a larger amount of threads. The run-method of the session-jobs I've copied 
from the SingleThreadRTPSession class as in the code below. After each run, the 
jobs are reinserted into the pool until they are marked as stopped. I'm not 
currently using commoncpp:s thread-library så I had to comment out the calls to 
setCancel. Potential problem? 

If someone is interested in my modifications to the SingleRTPSessionPool, I've 
added a support request where my version of the session pool is attached 

Any thoughts?

bool NoThreadRTPSession::run()
    microtimeout_t timeout = 0;

    if ( timeout < 1000 ){ // !(timeout/1000)
        timeout = getSchedulingTimeout();
    microtimeout_t maxWait = 
    // make sure the scheduling timeout is
    // <= the check interval for RTCP
    // packets
    timeout = (timeout > maxWait)? maxWait : timeout;
    if ( timeout < 1000 ) { // !(timeout/1000)
    } else {
        if ( isPendingData(timeout/1000) ) {
        timeout = 0;
    Return true;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]