Created
December 4, 2012 03:13
-
-
Save tarui/4200207 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: thread.c | |
=================================================================== | |
--- thread.c (revision 38172) | |
+++ thread.c (working copy) | |
@@ -4337,6 +4337,19 @@ | |
return Qnil; | |
} | |
+static VALUE | |
+rb_mutex_lock_sure(VALUE self) | |
+{ | |
+ rb_thread_t *th = GET_THREAD(); | |
+ VALUE mask =rb_hash_new(); | |
+ | |
+ rb_hash_aset(mask,rb_cObject,ID2SYM(rb_intern("defer"))); | |
+ rb_ary_push(th->async_errinfo_mask_stack,mask); | |
+ rb_mutex_lock(self); | |
+ rb_ary_pop(th->async_errinfo_mask_stack); | |
+ return self; | |
+} | |
+ | |
VALUE | |
rb_mutex_sleep(VALUE self, VALUE timeout) | |
{ | |
@@ -4349,10 +4362,10 @@ | |
rb_mutex_unlock(self); | |
beg = time(0); | |
if (NIL_P(timeout)) { | |
- rb_ensure(rb_mutex_sleep_forever, Qnil, rb_mutex_lock, self); | |
+ rb_ensure(rb_mutex_sleep_forever, Qnil, rb_mutex_lock_sure, self); | |
} | |
else { | |
- rb_ensure(rb_mutex_wait_for, (VALUE)&t, rb_mutex_lock, self); | |
+ rb_ensure(rb_mutex_wait_for, (VALUE)&t, rb_mutex_lock_sure, self); | |
} | |
end = time(0) - beg; | |
return INT2FIX(end); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment