Created
October 17, 2012 17:32
-
-
Save gustavoanatoly/3906907 to your computer and use it in GitHub Desktop.
deadlock; recursive lock
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
/* | |
* call-seq: | |
* mutex.try_lock -> true or false | |
* | |
* Attempts to obtain the lock and returns immediately. Returns +true+ if the | |
* lock was granted. | |
*/ | |
VALUE | |
rb_mutex_trylock(VALUE self) { | |
/* | |
* line 3936 | |
*/ | |
if (rb_mutex_trylock(self) == Qfalse) { | |
rb_mutex_t *mutex; | |
rb_thread_t *th = GET_THREAD(); | |
GetMutexPtr(self, mutex); | |
if (mutex->th == GET_THREAD()) { | |
rb_raise(rb_eThreadError, "deadlock; recursive locking"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment