Date: Fri, 13 Feb 2004 17:59:56 +0200 From: "Aylin Kantarci" <kantarci@bornova.ege.edu.tr> To: <freebsd-realtime@freebsd.org> Subject: A question on pthreads Message-ID: <001101c3f24a$6e4a4a50$6a18df9b@compeng.ege.edu.tr>
next in thread | raw e-mail | index | archive | help
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 posix4 libraries. 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 loop 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 while (1) { receive a packet from the network . . . _} Algorithm for the 2nd one . . .{ while (1) { . . pthread mutex lock(cont) consume packets . . } Algorithm for the 3rd one { while (1) { wait for a signal to arrive when the periodic timer ticks. pthread mutex unlock( cont) } Thanks in advance Dr. Aylin Kantarci
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001101c3f24a$6e4a4a50$6a18df9b>