Changeset 9627 for trunk/src


Ignore:
Timestamp:
Jan 6, 2003, 2:05:40 PM (23 years ago)
Author:
sandervl
Message:

Better method to cancel all async requests in WSACleanup

Location:
trunk/src/wsock32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wsock32/asyncthread.cpp

    r7992 r9627  
    1 /* $Id: asyncthread.cpp,v 1.15 2002-02-23 16:39:09 sandervl Exp $ */
     1/* $Id: asyncthread.cpp,v 1.16 2003-01-06 13:05:40 sandervl Exp $ */
    22
    33/*
     
    121121void WSACancelAllAsyncRequests()
    122122{
    123  PASYNCTHREADPARM pThreadInfo;
    124  BOOL             found = FALSE;
     123   PASYNCTHREADPARM pThreadInfo;
    125124
    126125   dprintf(("WSACancelAllAsyncRequests"));
     
    135134   }
    136135   asyncThreadMutex.leave();
    137    //TODO: not the right way to wait for the async threads to die
    138    DosSleep(250);
     136}
     137//******************************************************************************
     138//******************************************************************************
     139void WSAWaitForAllAsyncRequests()
     140{
     141   int wait = 0;
     142
     143   dprintf(("WSAWaitForAllAsyncRequests"));
     144
     145   //We don't want to wait forever until all async request threads have died
     146   //(just in case something goes wrong in select())
     147   //So wait up to one second for all threads to end.
     148   while(threadList && wait < 1000) {
     149       DosSleep(20);
     150       wait += 20;
     151   }
    139152}
    140153//******************************************************************************
  • trunk/src/wsock32/asyncthread.h

    r8939 r9627  
    1 /* $Id: asyncthread.h,v 1.13 2002-07-30 15:34:51 achimha Exp $ */
     1/* $Id: asyncthread.h,v 1.14 2003-01-06 13:05:40 sandervl Exp $ */
    22
    33/*
     
    9393
    9494void  WSACancelAllAsyncRequests();
     95void  WSAWaitForAllAsyncRequests();
    9596
    9697#endif  //__ASYNCTHREAD_H__
  • trunk/src/wsock32/wsa.cpp

    r8092 r9627  
    1 /* $Id: wsa.cpp,v 1.9 2002-03-18 10:03:49 sandervl Exp $ */
     1/* $Id: wsa.cpp,v 1.10 2003-01-06 13:05:40 sandervl Exp $ */
    22
    33/*
     
    9494        WSACancelAllAsyncRequests();
    9595        winsockcleanupsockets();
     96        WSAWaitForAllAsyncRequests();
    9697
    9798        fWSAInitialized = FALSE;
Note: See TracChangeset for help on using the changeset viewer.