[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
enough.
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
(https://savannah.gnu.org/support/index.php?func=detailitem&item_id=105229).
Any thoughts?
----------------------------------------------------------
bool NoThreadRTPSession::run()
{
microtimeout_t timeout = 0;
if ( timeout < 1000 ){ // !(timeout/1000)
timeout = getSchedulingTimeout();
}
//setCancel(cancelDeferred);
controlReceptionService();
controlTransmissionService();
//setCancel(cancelImmediate);
microtimeout_t maxWait =
timeval2microtimeout(getRTCPCheckInterval());
// make sure the scheduling timeout is
// <= the check interval for RTCP
// packets
timeout = (timeout > maxWait)? maxWait : timeout;
if ( timeout < 1000 ) { // !(timeout/1000)
//setCancel(cancelDeferred);
dispatchDataPacket();
//setCancel(cancelImmediate);
timerTick();
} else {
if ( isPendingData(timeout/1000) ) {
//setCancel(cancelDeferred);
takeInDataPacket();
//setCancel(cancelImmediate);
}
timeout = 0;
}
Thread::sleep(5);
Return true;
}
- [Ccrtp-devel] SingleRTPSessionPool is not thread safe.,
Jörgen Terner <=