Boost logo

Boost :

Subject: Re: [boost] [thread] throw during new boost::thread() ??
From: David M. Cotter (me_at_[hidden])
Date: 2010-08-21 19:21:06

>> these threads live a very short time and only maybe ten max are
>> alive at any one time.
>> for example if i'm iterating over every song in my music library and
>> doing some quick process, after about 5500 songs, the program stops
>> working.
>> i'm exiting the threads normally, so housekeeping is performed (tho
>> it would be performed anyway, right?)
>> i checked and when it crashes there are indeed only about five
>> threads running. so SOME resource is not getting released, it's not
>> my resource, it's something to do with boost::threads.
> Well, if things are *really* borked when it crashes, you might not be
> getting an accurate count of the running threads, or perhaps they've
> all exited by the time you actually check. No matter how quick the
> task, without something to keep the number of actual simultaneous
> threads under control, you *are* very likely launching all 5500 of
> them at once in a way that—at best—will never perform well.

well, things aren't borked, i can assure you that no more than ten are running at once

during my test, i increment a "live" count and a "done" count, and they never differ by more than say five. if they do, i assert.
so it's simply not possible that more than five are live at once.

put another way, i have a live thread count that in inc's when a thread is created and dec's when a thread is destroyed. and that count never goes over five.

performance has never been an issue. in my actual app i'm not actually just performing a tight loop spawning threads. there's a lot happening between spawnings and threads close at the same rate they are opened. again i've never had more than about five open at once.

Boost list run by bdawes at, gregod at, cpdaniel at, john at