Add shared objects that can be used by all threads at their root scope only

This commit is contained in:
Jason Turner
2009-09-03 11:42:23 +00:00
parent a427d2c1a9
commit 4d42d6ff33
4 changed files with 70 additions and 24 deletions

View File

@@ -13,13 +13,15 @@
void do_work(chaiscript::ChaiScript &c)
{
c("use(\"work.chai\"); do_chai_work();");
c("use(\"work.chai\"); do_chai_work(num_iterations);");
}
int main(int argc, char *argv[]) {
std::string input;
chaiscript::ChaiScript chai;
chai.add_shared_object(chaiscript::Boxed_Value(10000), "num_iterations");
std::vector<boost::shared_ptr<boost::thread> > threads;
for (int i = 0; i < argc - 1; ++i)