Class: Thread
Overview
This file is part of the rallhook project, github.com/tario/
Copyright © 2009-2010 Roberto Dario Seminara <[email protected]>
rallhook is free software: you can redistribute it and/or modify it under the terms of the gnu general public license as published by the free software foundation, either version 3 of the license, or (at your option) any later version.
rallhook is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. see the gnu general public license for more details.
you should have received a copy of the gnu general public license along with rallhook. if not, see <www.gnu.org/licenses/>.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.new ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/rallhook/thread_hook.rb', line 28 def new parent = current original_new do parent.acquire_attributes do yield end end end |
.original_new ⇒ Object
24 |
# File 'lib/rallhook/thread_hook.rb', line 24 alias :original_new :new |
Instance Method Details
#acquire_attributes ⇒ Object
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'ext/rallhook_base/rallhook.c', line 289 VALUE rb_thread_acquire_attributes( VALUE thread ) { AttachedThreadInfo* orig = tinfo_from_thread(thread); AttachedThreadInfo* dest = tinfo_from_thread(rb_thread_current() ); AttachedThreadInfo oldattr; oldattr.hook_enabled = dest->hook_enabled; oldattr.hook_enable_left = dest->hook_enable_left; oldattr.hook_proc = dest->hook_proc; oldattr.handle_method_arity = dest->handle_method_arity; dest->hook_enabled = orig->hook_enabled; dest->hook_enable_left = orig->hook_enable_left; dest->hook_proc = orig->hook_proc; dest->handle_method_arity = orig->handle_method_arity; if (rb_block_given_p() ) { return rb_ensure(rb_yield, Qnil, thread_restore_attributes, (VALUE)&oldattr); } return Qnil; } |