thread_pthread.c: microptimize vm->gvl.waiting checks
"gvl.waiting" is volatile, so the compiler won't perform these optimizations for us. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cc6342fec3
commit
0e2ba8495e
@ -73,8 +73,7 @@ gvl_acquire_common(rb_vm_t *vm)
|
|||||||
{
|
{
|
||||||
if (vm->gvl.acquired) {
|
if (vm->gvl.acquired) {
|
||||||
|
|
||||||
vm->gvl.waiting++;
|
if (!vm->gvl.waiting++) {
|
||||||
if (vm->gvl.waiting == 1) {
|
|
||||||
/*
|
/*
|
||||||
* Wake up timer thread iff timer thread is slept.
|
* Wake up timer thread iff timer thread is slept.
|
||||||
* When timer thread is polling mode, we don't want to
|
* When timer thread is polling mode, we don't want to
|
||||||
@ -87,7 +86,7 @@ gvl_acquire_common(rb_vm_t *vm)
|
|||||||
rb_native_cond_wait(&vm->gvl.cond, &vm->gvl.lock);
|
rb_native_cond_wait(&vm->gvl.cond, &vm->gvl.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
vm->gvl.waiting--;
|
--vm->gvl.waiting;
|
||||||
|
|
||||||
if (vm->gvl.need_yield) {
|
if (vm->gvl.need_yield) {
|
||||||
vm->gvl.need_yield = 0;
|
vm->gvl.need_yield = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user