I have this situation:
void my_thread(std::string const& a, std::string const& b)
{
}
void spawner()
{
boost::thread(boost::function
El 04/03/2010 10:03 p.m., anony escribió:
I have this situation:
void my_thread(std::string const& a, std::string const& b) { }
void spawner() { boost::thread(boost::function
(my_thread), "bla", "lala"); } This works, but is it possible that the string temporaries are destroyed before the thread starts running?
Extract from Boost.Thread documentation at
http://www.boost.org/doc/libs/1_42_0/doc/html/thread/thread_management.html#...
"Thread Constructor with arguments
template
El 05/03/2010 12:18 a.m., Agustín K-ballo Bergé escribió:
El 04/03/2010 10:03 p.m., anony escribió:
I have this situation: void spawner() { boost::thread(boost::function
(my_thread), "bla", "lala"); }
By the way, I think the use of boost::function is redundant. Doesn't it just work like this: boost::thread(my_thread, "bla", "lala"); Agustín K-ballo Bergé.- http://talesofcpp.blogspot.com
By the way, I think the use of boost::function is redundant. Doesn't it just work like this:
boost::thread(my_thread, "bla", "lala");
I wanted to give a simple example; in reality my_thread() is a method
and I use something like:
boost::thread(boost::function
The use of Boost.Function is irrelevant. I've checked Boost.Thread source code and it uses Boost.Bind internally. The use of Boost.Function actually increases code size, even though everything compiles and works.
participants (2)
-
Agustín K-ballo Bergé
-
anony