> 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. Get it now.