Boost logo

Boost Users :

From: Rob Caldecott (robert.caldecott_at_[hidden])
Date: 2006-10-11 12:38:38


I have just started to investigate the boost::thread library and have a couple
of questions (Win32/VS2005):

1. I have an application that creates lots of relatively short-lived threads.
When a thread is created I store the handle in an array, and at regular
intervals, I remove completed threads from the array by checking the thread
state via ::GetExitCodeThread. The application runs 24/7 so I don't want an
array containing thousands of "dead" handles.

I thought I'd replace this code with a boost::thread_group, but I cannot see any
way to remove completed threads from the internal list. This means the
std::list used by boost::thread_group would keep on increasing in size until the
application exits, which I want to avoid. If I decide to roll my own thread
group code, how can I check if a boost::thread is still active or not?

2. I am getting a memory leak when my application exits, which has already been
mentioned here. Does anyone have a fix for this which I can apply to the 1.33.1
source (then rebuilding the thread lib by hand)? It would be much appreciated.
 I am also unsure if this leak will be fixed for 1.34 - does anyone know for
certain?

Thanks in advance.


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