Boost logo

Boost Users :

Subject: Re: [Boost-users] Using boost::thread to keep all cores busy
From: Internet Retard (webretard_at_[hidden])
Date: 2010-07-27 18:59:15

> this approach is incorrect, look what can happen if for example
> the jobs container has last job to do:
> thread A performs the check jobs.empty() and it pass, before the
> thread A executes the job.front() another thread B does the check
> jobs.empty() and it pass as well, then thread A does the jobs.front()
> and then when thread B does a jobs.front() as well.

Thanks Gaetano and others for the helpful comments. I have working thread safe code now using boost threads. I learned a lot from your feedback. You are right, threads are subtle and require careful thought and attention.
Hotmail: Free, trusted and rich email service.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at