3 #include <boost/thread.hpp> 4 #include <boost/bind.hpp> 13 boost::mutex::scoped_lock lock(
guard);
31 int main(
int argc,
char *argv[]) {
34 R.
parseEvalQ(
"cat(\"Hello, world from main()\\n\")");
37 boost::thread_group thread_group;
38 thread_group.create_thread(boost::bind(
thread_func, boost::ref(resource)));
39 thread_group.create_thread(boost::bind(
thread_func, boost::ref(resource)));
40 thread_group.join_all();
41 std::cout <<
"At end value is " << resource.
getValue() << std::endl;
void parseEvalQ(const std::string &line)
int main(int argc, char *argv[])
void thread_func(Resource &resource)