summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-29 17:22:36 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-29 17:22:36 +0000
commit2285319b31aa00b121c688d0bc67740ba385ab75 (patch)
tree82a10ecf641c7c215906c958b8b051b384e8f49e /vm.c
parentb9cba0711b2753a26b9f1155ea62e2a8d07cc76e (diff)
* thread.c: added Thread#thread_variable_(get|set),
Thread#thread_variable?, and Thread#thread_variables for operating on variables that are local to threads. [ruby-core:47790] * vm.c: ditto * test/ruby/test_thread.rb: tests for thread variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/vm.c b/vm.c
index 39efee27c9..d4d4ebbb1c 100644
--- a/vm.c
+++ b/vm.c
@@ -1838,6 +1838,7 @@ ruby_thread_init(VALUE self)
GetThreadPtr(self, th);
th_init(th, self);
+ rb_iv_set(self, "locals", rb_hash_new());
th->vm = vm;
th->top_wrapper = 0;
@@ -2178,6 +2179,7 @@ Init_VM(void)
/* create main thread */
th_self = th->self = TypedData_Wrap_Struct(rb_cThread, &thread_data_type, th);
+ rb_iv_set(th_self, "locals", rb_hash_new());
vm->main_thread = th;
vm->running_thread = th;
th->vm = vm;