mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/thread/thread.c (wait_list_cleanup, rb_mutex_try_lock):
Eliminate rb_thread_critical switching where unnecessary; implied by shugo in [ruby-dev:30412]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5386d05fb2
commit
e9ebc1c8db
2 changed files with 8 additions and 12 deletions
|
@ -1,5 +1,9 @@
|
||||||
Tue Feb 27 03:40:09 2007 Akinori MUSHA <knu@iDaemons.org>
|
Tue Feb 27 03:40:09 2007 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
|
* ext/thread/thread.c (wait_list_cleanup, rb_mutex_try_lock):
|
||||||
|
Eliminate rb_thread_critical switching where unnecessary;
|
||||||
|
implied by shugo in [ruby-dev:30412].
|
||||||
|
|
||||||
* ext/thread/thread.c (set_critical): Merge in
|
* ext/thread/thread.c (set_critical): Merge in
|
||||||
thread_exclusive_ensure().
|
thread_exclusive_ensure().
|
||||||
|
|
||||||
|
|
|
@ -247,9 +247,7 @@ static VALUE
|
||||||
wait_list_cleanup(List *list)
|
wait_list_cleanup(List *list)
|
||||||
{
|
{
|
||||||
/* cleanup in case of spurious wakeups */
|
/* cleanup in case of spurious wakeups */
|
||||||
rb_thread_critical = 1;
|
|
||||||
remove_one(list, rb_thread_current());
|
remove_one(list, rb_thread_current());
|
||||||
rb_thread_critical = 0;
|
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,20 +372,14 @@ static VALUE
|
||||||
rb_mutex_try_lock(VALUE self)
|
rb_mutex_try_lock(VALUE self)
|
||||||
{
|
{
|
||||||
Mutex *mutex;
|
Mutex *mutex;
|
||||||
VALUE result;
|
|
||||||
|
|
||||||
Data_Get_Struct(self, Mutex, mutex);
|
Data_Get_Struct(self, Mutex, mutex);
|
||||||
|
|
||||||
result = Qfalse;
|
if (RTEST(mutex->owner))
|
||||||
|
return Qfalse;
|
||||||
|
|
||||||
rb_thread_critical = 1;
|
mutex->owner = rb_thread_current();
|
||||||
if (!RTEST(mutex->owner)) {
|
return Qtrue;
|
||||||
mutex->owner = rb_thread_current();
|
|
||||||
result = Qtrue;
|
|
||||||
}
|
|
||||||
rb_thread_critical = 0;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue