| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
[Bug #19105]
If no fiber scheduler is registered and the fiber that
owns the lock and the one that try to acquire it
both belong to the same thread, we're in a deadlock case.
Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
|
|
|
| |
* Ensure that blocked fibers don't prevent valid wakeups.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
[Feature #18982]
Instead of introducing an `exception: false` argument to have `non_block`
return nil rather than raise, we can clearly document that a timeout of 0
immediately returns.
The code is refactored a bit to avoid doing a time calculation in
such case.
|
|
|
|
|
|
|
| |
[Feature #18944]
If both `non_block=true` and `timeout:` are supplied, ArgumentError
is raised.
|
| |
|
|
|
|
|
|
|
|
|
| |
When I removed the SizeQueue#push timeout from my PR, I forgot to
update the `queue_sleep` parameters to be a `queue_sleep_arg`.
Somehow this worked on most archs, but on Solaris/Sparc it would
legitimately crash when trying to access the `timeout` and `end`
members of the struct.
|
|
|
|
|
|
|
|
|
| |
[Feature #18774]
As well as `SizedQueue#pop(timeout: sec)`
If both `non_block=true` and `timeout:` are supplied, ArgumentError
is raised.
|
|
|
|
|
|
| |
rb_ary_tmp_new suggests that the array is temporary in some way, but
that's not true, it just creates an array that's hidden and not on the
transient heap. This commit renames it to rb_ary_hidden_new.
|
|
|
|
| |
[Misc #18891]
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Prefixed ccan headers
* Remove unprefixed names in ccan/build_assert
* Remove unprefixed names in ccan/check_type
* Remove unprefixed names in ccan/container_of
* Remove unprefixed names in ccan/list
Co-authored-by: Samuel Williams <samuel.williams@oriontransfer.co.nz>
|
| |
|
| |
|
|
|
|
|
|
| |
mutex_mark is (basically) NULL, so we don't have any references to mark.
This means we should safely be able to mark Mutex as WB_PROTECTED
without changing anything else.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Reduce duplications
* ID caluculations of the same name
* checks against the same name
* registration to the root module hash
|
|
|
|
|
|
|
|
|
| |
* --braces-after-func-def-line
* --dont-cuddle-else
* --procnames-start-lines
* --space-after-for
* --space-after-if
* --space-after-while
|
| |
|
| |
|
| |
|
|
|
|
| |
Enumerable implements #to_a but not #to_array.
|
|
|
|
| |
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
|
|
|
|
|
|
|
| |
* Rename `rb_scheduler` to `rb_fiber_scheduler`.
* Use public interface if available.
* Use `rb_check_funcall` where possible.
* Don't use `unblock` unless the fiber was non-blocking.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
When a scheduler is present, it's entirely possible for
`th->keeping_mutexes` to be updated while enumerating the waitq. Therefore
it must be fetched only during the removal operation.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
* 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().
|
| |
|
|
|
|
|
|
|
|
| |
* When there is a scheduler, the Fiber that would be blocked has already
been rescheduled and there is no point to interrupt something else.
That blocked Fiber will be rescheduled as the next call to the scheduler
(e.g., IO, sleep, other blocking sync).
* See discussion on https://github.com/ruby/ruby/commit/d01954632d
|
|
|
|
| |
* Mutex operations no longer disable the Fiber scheduler.
|
|
|
|
|
| |
* To still remove the lock from the Thread's list of acquired locks.
* Also to not wake up other waiters and preserve blocking behavior.
|
|
|
|
| |
* It would hit "[BUG] unexpected THREAD_STOPPED" before.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
* Move #kernel_sleep next to #block as it is similar
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
* 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]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit introduces Ractor mechanism to run Ruby program in
parallel. See doc/ractor.md for more details about Ractor.
See ticket [Feature #17100] to see the implementation details
and discussions.
[Feature #17100]
This commit does not complete the implementation. You can find
many bugs on using Ractor. Also the specification will be changed
so that this feature is experimental. You will see a warning when
you make the first Ractor with `Ractor.new`.
I hope this feature can help programmers from thread-safety issues.
|
|
|
|
|
| |
I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea. Better refactor.
|
| |
|
| |
|
|
|
|
|
|
| |
Function pointers are not void*. See also
ce4ea956d24eab5089a143bba38126f2b11b55b6
8427fca49bd85205f5a8766292dd893f003c0e48
|