Moved locking VM to an atomic operation
This commit is contained in:
parent
2148ee78a5
commit
983f6d0f2a
8
ractor.c
8
ractor.c
|
@ -290,7 +290,7 @@ RACTOR_PTR(VALUE self)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t ractor_last_id;
|
static rb_atomic_t ractor_last_id;
|
||||||
|
|
||||||
#if RACTOR_CHECK_MODE > 0
|
#if RACTOR_CHECK_MODE > 0
|
||||||
MJIT_FUNC_EXPORTED uint32_t
|
MJIT_FUNC_EXPORTED uint32_t
|
||||||
|
@ -1399,11 +1399,7 @@ ractor_next_id(void)
|
||||||
{
|
{
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
|
|
||||||
RB_VM_LOCK();
|
id = (uint32_t)(RUBY_ATOMIC_FETCH_ADD(ractor_last_id, 1) + 1);
|
||||||
{
|
|
||||||
id = ++ractor_last_id;
|
|
||||||
}
|
|
||||||
RB_VM_UNLOCK();
|
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue