Benoit Daloze
b8eb08e096
Fix TestFiberMutex#test_condition_variable assertion
...
* Now that it works correctly.
2020-11-08 16:49:33 +01:00
Samuel Williams
a08ee8330d
Rename to Fiber#set_scheduler
.
2020-11-07 23:39:50 +13:00
Nobuyoshi Nakada
1d3024da26
Refined assertions for better failure messages
2020-10-01 13:48:15 +09:00
Samuel Williams
dd2e95fb26
Remove Thread.scheduler
from public interface.
...
It's implementation is equivalent to:
Thread.current.scheduler unless Thread.current.blocking?
2020-10-01 16:56:05 +13:00
Benoit Daloze
6987c8997e
Remove from waiter in Mutex#lock with ensure when calling rb_scheduler_block()
...
* Previously this could lead to an invalid waiter entry and then trying
to wake up that waiter would result in various issues in rb_mutex_unlock_th().
2020-09-20 13:35:39 +02:00
Benoit Daloze
264889ec3d
Fix Mutex#unlock with a scheduler and thread contention
...
* It would hit "[BUG] unexpected THREAD_STOPPED" before.
2020-09-17 15:15:43 +02:00
Benoit Daloze
9472d16061
Call scheduler.block instead of scheduler.kernel_sleep for blocking Queue/SizedQueue operations
...
* scheduler.unblock was already already called before but with no corresponding scheduler.block
* add test that Queue#pop makes the scheduler wait until it gets an element.
2020-09-17 14:59:38 +02:00
Samuel Williams
8eea66a0ca
Add support for Queue & SizedQueue.
2020-09-14 16:44:09 +12:00
Samuel Williams
0f613cc5f1
Add support for ConditionVariable.
2020-09-14 16:44:09 +12:00
Benoit Daloze
178c1b0922
Make Mutex per-Fiber instead of per-Thread
...
* Enables Mutex to be used as synchronization between multiple Fibers
of the same Thread.
* With a Fiber scheduler we can yield to another Fiber on contended
Mutex#lock instead of blocking the entire thread.
* This also makes the behavior of Mutex consistent across CRuby, JRuby and TruffleRuby.
* [Feature #16792 ]
2020-09-14 16:44:09 +12:00
Samuel Williams
132453fa52
Rename Fiber{}
to Fiber.schedule{}
.
2020-09-14 16:44:09 +12:00
Hiroshi SHIBATA
d48c92aa04
Rename TestScheduler* to TestFiber for convention of the test directory
2020-05-23 16:44:57 +09:00
Samuel Williams
6fa8455ebb
Move test/scheduler
-> test/fiber
[Bug #16892 ][ruby-core:98366].
2020-05-15 13:26:23 +12:00