Boost logo

Boost Users :

Subject: [Boost-users] Switching from CreateThread to boost::thread
From: Kurt D. Knudsen (kknudsen_at_[hidden])
Date: 2010-02-05 13:03:02


 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:
 
Visit: http://pastebin.com/d6655b246 Seems to reject me sending that
many lines.
 
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



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net