Fixed thread reference leak in network code.

This commit is contained in:
crs 2004-05-12 19:50:58 +00:00
parent a59ad51ce2
commit 455d0210b2
2 changed files with 5 additions and 1 deletions

View File

@ -827,7 +827,10 @@ const int*
CArchNetworkBSD::getUnblockPipe() CArchNetworkBSD::getUnblockPipe()
{ {
CArchMultithreadPosix* mt = CArchMultithreadPosix::getInstance(); CArchMultithreadPosix* mt = CArchMultithreadPosix::getInstance();
return getUnblockPipeForThread(mt->newCurrentThread()); CArchThread thread = mt->newCurrentThread();
const int* p = getUnblockPipeForThread(thread);
ARCH->closeThread(thread);
return p;
} }
const int* const int*

View File

@ -418,6 +418,7 @@ CArchNetworkWinsock::pollSocket(CPollEntry pe[], int num, double timeout)
CArchMultithreadWindows* mt = CArchMultithreadWindows::getInstance(); CArchMultithreadWindows* mt = CArchMultithreadWindows::getInstance();
CArchThread thread = mt->newCurrentThread(); CArchThread thread = mt->newCurrentThread();
WSAEVENT* unblockEvent = (WSAEVENT*)mt->getNetworkDataForThread(thread); WSAEVENT* unblockEvent = (WSAEVENT*)mt->getNetworkDataForThread(thread);
ARCH->closeThread(thread);
if (unblockEvent == NULL) { if (unblockEvent == NULL) {
unblockEvent = new WSAEVENT; unblockEvent = new WSAEVENT;
*unblockEvent = WSACreateEvent_winsock(); *unblockEvent = WSACreateEvent_winsock();