Boost logo

Boost Users :

Subject: Re: [Boost-users] Thread can not run concurrently with bind parameter
From: Christian Henning (chhenning_at_[hidden])
Date: 2010-06-06 17:27:36


Hi there,

> using bind, like
> boost::thread thrd(boost::bind(&helloworld, "Bob"));
> thrd.join();

I prefer bind.

> The second thread will blocked by
> the first thread. If the first thread never exit, the second thread never
> run. It is a very funny problem. But I really do not know what happen. Does
> anyone know about this topic?

Please provide a code sample that shows your problems. Also, make sure
you create the two threads first before you you call any join().

Since you are calling your thread function helloworld, I suspect
you're using the threads to print out some text on the console. Some
systems will provide a basic locking scheme when several threads
accessing stdout file. Use an endless loop in your thread function and
you'll see them running concurrently.

Regards,
Christian


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