Hi
all,
Currently, I'm
working on a Windows C++ program that was developed by a third party and I'm
just working out the kinks and adding new features. I'm not 100% familar with
threads, but I think I have the general idea down. The project is a
client/server backup solution. The problem I am running into is this after the
code pasted below:
So this workerThread
passes the socket off to another function that handles the command connection
and then deletes/frees the data used. All that aside, here's the issue. This
while-loop generates hundreds of thousands of handles in a matter of days. This
causes all kinds of problems on the server (there's a similar issue with clients
using identical functions) and either the server needs to be rebooted or the
program shut down. I tried to use WaitForSingleObject() and then CloseHandle()
but it seems to close the handle prematurely. This causes the client/server to
not communicate and interrupt any data transfer. I am wondering if using
boost::thread will make handling the destruction of the threads easier. I've
been researching it but I can't find any solid information on whether or not
CloseHandle(), or something similar, needs to be run. I'm just trying to see if
using Boost is the right direction to go.
Thanks,
Kurt