
Roland wrote:
Maybe this could be replaceed with RegisterWaitForSingleObject (waiting for thread handle)?
This would increase the number of threads seriously, since you can only wait for a very limited number of objects in a call to WaitFor.
RegisterWaitForSingleObject utilizes the builtin threadpool and is only availble in the following versions of the MS OSs which might pose a problem. Client: Requires Windows XP or Windows 2000 Professional. Server: Requires Windows Server 2003 or Windows 2000 Server. Each thread can wait on 64 objects so my guess is that the threadpool will spawn another thread for every 60-63 threads since its bound to listen to some internal events as well. And an overhead of 1 threads per ~60 isn't that bad, since any design that utilizes that many concurrent threads should be questioned anyway. And the function wont be called in the exiting threads context which might make it hard to use for the purpose. /Michel