diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-29 17:22:36 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-29 17:22:36 +0000 |
commit | 2285319b31aa00b121c688d0bc67740ba385ab75 (patch) | |
tree | 82a10ecf641c7c215906c958b8b051b384e8f49e /vm.c | |
parent | b9cba0711b2753a26b9f1155ea62e2a8d07cc76e (diff) | |
download | ruby-2285319b31aa00b121c688d0bc67740ba385ab75.tar.gz |
* 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.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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; |