diff options
| author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-04-12 08:14:54 +0000 |
|---|---|---|
| committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-04-12 08:14:54 +0000 |
| commit | c6f5fc2de190dfb19fa8f02de71934bf85db3147 (patch) | |
| tree | fb38b6f2fe8a01adc8cfdabad03d8ae7e30f52b0 /thread.c | |
| parent | 84d720836515f802fcb49058b9c1074e72bc2a21 (diff) | |
| download | ruby-c6f5fc2de190dfb19fa8f02de71934bf85db3147.tar.gz ruby-c6f5fc2de190dfb19fa8f02de71934bf85db3147.tar.xz ruby-c6f5fc2de190dfb19fa8f02de71934bf85db3147.zip | |
* thread.c (mutex_try_lock): check and set owner thread.
* thread_pthread.ci: fix to show error code in error message.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
| -rw-r--r-- | thread.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -2138,7 +2138,12 @@ mutex_try_lock(VALUE self) mutex_t *mutex; GetMutexVal(self, mutex); + if (mutex->th == GET_THREAD()) { + rb_raise(rb_eThreadError, "deadlock; recursive locking"); + } + if (native_mutex_trylock(&mutex->lock) != EBUSY) { + mutex->th = GET_THREAD(); return Qtrue; } else { |
