Make sure that stack is properly initialized on a per-thread basis. Fixes #95wq

This commit is contained in:
Jason Turner 2010-07-23 20:00:17 +00:00
parent f7086c10ec
commit f5f99961c1
2 changed files with 4 additions and 3 deletions

View File

@ -209,8 +209,6 @@ namespace chaiscript
Dispatch_Engine() Dispatch_Engine()
: m_place_holder(boost::shared_ptr<Placeholder_Object>(new Placeholder_Object())) : m_place_holder(boost::shared_ptr<Placeholder_Object>(new Placeholder_Object()))
{ {
StackData &stack = get_stack_data();
stack.get<1>().push_back(Scope());
} }
~Dispatch_Engine() ~Dispatch_Engine()
@ -748,6 +746,7 @@ namespace chaiscript
Stack_Holder() Stack_Holder()
: stack(new StackData()) : stack(new StackData())
{ {
stack->get<1>().push_back(Scope());
stack->get<2>() = true; stack->get<2>() = true;
} }

View File

@ -13,7 +13,9 @@
void do_work(chaiscript::ChaiScript &c) void do_work(chaiscript::ChaiScript &c)
{ {
// c("use(\"work.chai\"); do_chai_work(num_iterations);"); // c("use(\"work.chai\"); do_chai_work(num_iterations);");
std::string name = "MyVar" + boost::lexical_cast<std::string>(rand());
c.add(chaiscript::var(5), name);
c("use(\"work.chai\"); do_chai_work(10000);"); c("use(\"work.chai\"); do_chai_work(10000);");
} }