$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: boostguy_at_[hidden]
Date: 2006-02-06 14:52:28
Hi all,
I am trying to write a generalized object oriented wrapper for thread
library implementation of Boost.
Boost threads take a function name as an argument when creting a
thread. I would like create a warpper in C++ which would in some
respects mimic JAVA and have a runnable interface which an threaded
application would implement.
This code would explain what I want to do.. but my question is how can I
do it or if there are already some wrappers out there that I can use for
boost threads?
Sample code :
----- MyThread.h -----
#include "myRunnable.h"
#include <boost/thread/thread.hpp>
class MyThread
{
private:
Runnable& task;
boost::thread thr;
public:
MyThread( Runnable& threadTask )
: task( threadTask ),
thr( &task.run) // how do I do this ?
{
}
};
---------------------------
Thanks,
Dhanvi