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.
https://signup.live.com/signup.aspx?id=60969



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