[Opalvoip-svn] SF.net SVN: opalvoip: [18757] ptlib/trunk
Brought to you by:
csoutheren,
rjongbloed
From: <rjo...@us...> - 2007-10-23 07:29:22
|
Revision: 18757 http://opalvoip.svn.sourceforge.net/opalvoip/?rev=18757&view=rev Author: rjongbloed Date: 2007-10-23 00:29:26 -0700 (Tue, 23 Oct 2007) Log Message: ----------- Applied OpenH323 patch 1240291 Select() on the same socket from multiple threads (simul read/write) Thanks Boris Pavacic - bpavacic Modified Paths: -------------- ptlib/trunk/include/ptlib/unix/ptlib/channel.h ptlib/trunk/src/ptlib/unix/channel.cxx ptlib/trunk/src/ptlib/unix/socket.cxx Modified: ptlib/trunk/include/ptlib/unix/ptlib/channel.h =================================================================== --- ptlib/trunk/include/ptlib/unix/ptlib/channel.h 2007-10-23 07:04:58 UTC (rev 18756) +++ ptlib/trunk/include/ptlib/unix/ptlib/channel.h 2007-10-23 07:29:26 UTC (rev 18757) @@ -128,8 +128,8 @@ PThread * px_readThread; PThread * px_writeThread; PMutex px_writeMutex; - PThread * px_selectThread; - PMutex px_selectMutex; + PThread * px_selectThread[3]; + PMutex px_selectMutex[3]; #endif //#ifndef __PCHANNEL_UNIX__ Modified: ptlib/trunk/src/ptlib/unix/channel.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/channel.cxx 2007-10-23 07:04:58 UTC (rev 18756) +++ ptlib/trunk/src/ptlib/unix/channel.cxx 2007-10-23 07:29:26 UTC (rev 18757) @@ -182,7 +182,9 @@ px_lastBlockType = PXReadBlock; px_readThread = NULL; px_writeThread = NULL; - px_selectThread = NULL; + px_selectThread[0] = NULL; + px_selectThread[1] = NULL; + px_selectThread[2] = NULL; } @@ -414,7 +416,9 @@ AbortIO(px_readThread, px_threadMutex); AbortIO(px_writeThread, px_threadMutex); - AbortIO(px_selectThread, px_threadMutex); + AbortIO(px_selectThread[0], px_threadMutex); + AbortIO(px_selectThread[1], px_threadMutex); + AbortIO(px_selectThread[2], px_threadMutex); int stat; do { Modified: ptlib/trunk/src/ptlib/unix/socket.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/socket.cxx 2007-10-23 07:04:58 UTC (rev 18756) +++ ptlib/trunk/src/ptlib/unix/socket.cxx 2007-10-23 07:29:26 UTC (rev 18757) @@ -552,8 +552,8 @@ if (h > maxfds) maxfds = h; } - socket.px_selectMutex.Wait(); - socket.px_selectThread = unblockThread; + socket.px_selectMutex[i].Wait(); + socket.px_selectThread[i] = unblockThread; } } @@ -572,8 +572,8 @@ for (i = 0; i < 3; i++) { for (j = 0; j < list[i]->GetSize(); j++) { PSocket & socket = (*list[i])[j]; - socket.px_selectThread = NULL; - socket.px_selectMutex.Signal(); + socket.px_selectThread[i] = NULL; + socket.px_selectMutex[i].Signal(); if (lastError == NoError) { int h = socket.GetHandle(); if (h < 0) @@ -614,8 +614,8 @@ if (h > maxfds) maxfds = h; } - socket.px_selectMutex.Wait(); - socket.px_selectThread = unblockThread; + socket.px_selectMutex[i].Wait(); + socket.px_selectThread[i] = unblockThread; } } @@ -644,8 +644,8 @@ for (i = 0; i < 3; i++) { for (j = 0; j < list[i]->GetSize(); j++) { PSocket & socket = (*list[i])[j]; - socket.px_selectThread = NULL; - socket.px_selectMutex.Signal(); + socket.px_selectThread[i] = NULL; + socket.px_selectMutex[i].Signal(); if (lastError == NoError) { int h = socket.GetHandle(); if (h < 0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |