A question on pthreads
kantarci at bornova.ege.edu.tr
Fri Feb 13 07:48:21 PST 2004
Now I have a question about my multithreaded application. I will be very
glad if you could be helpful.
I am developing the software on Solaris 9 platform and using pthread and
There are 3 threads in the application and a periodic realtime thread.
The 1st thread receives packets from the network at small intervals.
The second thread catches signals from the periodic timer.
the 3rd thread consumes a group of packets at each clock tick.
The second and the third thread synchronizes with a mutex. 2nd thread
unlocks the mutex when the clock ticks.
the third thread tries to lock the mutex and consumes the packets in a
All threads arse defined with the scope SYSTEM_SCOPE. I am setting the
thread concurrency to 5. I think I am using bounded threads.
I observed that when the 2nd thread tries to lock the mutex, the 1st
thread also blocks and stops receiving packets from the network. The 1st
thread uses an implementation of RTP library which is not thread safe.
I want the first thread to continue to receive packets from the network
when the second thread blocks on the semaphore.
Algorthm for the first thread
receive a packet from the network
Algorithm for the 2nd one
pthread mutex lock(cont)
Algorithm for the 3rd one
wait for a signal to arrive when the periodic timer ticks.
pthread mutex unlock( cont)
Thanks in advance
Dr. Aylin Kantarci
More information about the freebsd-realtime