Boost logo

Boost Users :

From: Luis De la Parra (lparrab_at_[hidden])
Date: 2002-09-05 16:34:39


hi all,
is there a way to get a reference to the function object used by a
boost::thread object??
when you create a new thread and feed it a function object it copies it and
then starts a new thread of execution on this object.. well, I would like to
send messages to the object in which the thread is running but I don't know
how to do it with boos.threads...

is there a way to tell boost:thread not to copy the function object but to use
it directly?, or to ask the thread object to give a reference to the object?

I am now doing a dirty hack which consists of the object putting itself (a
pointer) in a static chained list during construction and remove itself in
the destructor, this way I can call a static member function which returns
this list to get a hold of the object. There is also a static mutex
protecting this list to make sure no other objects are created / destructed
while one of them is inserting or removing itself from the list. it is
working, but I don't think this is a very "clean" approach.. does anyone have
any ideas how it could be done better??

thank you.
regards, luis.


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