|
Boost Users : |
From: Honki (nagut_at_[hidden])
Date: 2007-11-06 07:19:44
Hi boost-users,
I'm new in the mailing list, so I hope, that I'm right here and you can
help me.
I want to start a ThreadClass that includes some boost::mutex variables,
but it doesn't work because of the "noncopyable" definition of the
mutex-class.
*******************MyClass*******************
......
class OutputProcessor_C
{
public:
ClientOutputProcessor_C();
virtual ~ClientOutputProcessor_C();
void operator()()
{
while( true )
{
boost::xtime wakeUpTime;
boost::xtime_get(&wakeUpTime, boost::TIME_UTC);
wakeUpTime.sec += ( 0.05 );
boost::thread::sleep( wakeUpTime );
Process();
}
}
protected:
void Process();
boost::mutex m_publishDataMutex;
......
*********************************************
*******************MyMain********************
......
int main(int argc, char* argv[])
{
// Classpointer
boost::shared_ptr<OutputProcessor_C()> outputProcessor(new
OutputProcessor_C());
// generate Thread
boost::shared_ptr<boost::thread> threadOutputProcessor(new
boost::thread(*outputProcessor));
......
*********************************************
When I tried to compile the source code, there is an error - "It is not
possible to copy the constructor for the class 'boost::mutex'". Where is
the problem? I don't want to copy anything. If it is not possible to
generate a simple thread class that includes some mutexes, that is
really weak.
Greetings,
Matthias
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