aboutsummaryrefslogtreecommitdiffstats
path: root/cont.c
Commit message (Collapse)AuthorAgeFilesLines
* Negative RBOOL usageNobuyoshi Nakada2022-01-011-1/+1
|
* Tidy up fiber scheduler interface documentation for `address_resolve` and ↵Samuel Williams2021-12-211-14/+34
| | | | `timeout_after`.
* Update cont.cSamuel Williams2021-12-211-8/+23
|
* Add SchedulerInterface#timeout_after and #address_resolve docszverok2021-12-211-0/+39
|
* Document Fiber::SchedulerInterface#io_read and #io_writezverok2021-12-211-1/+67
|
* Fix conflicting declaration on SolarisNobuyoshi Nakada2021-11-301-2/+1
| | | | | | | | | | | | | | | | | | | | SunC ``` "cont.c", line 24: identifier redeclared: madvise current : function(pointer to char, unsigned int, int) returning int previous: function(pointer to void, unsigned int, int) returning int : "/usr/include/sys/mman.h", line 232 ``` GCC ``` cont.c:24:12: error: conflicting types for 'madvise' 24 | extern int madvise(caddr_t, size_t, int); | ^~~~~~~ In file included from cont.c:16: /usr/include/sys/mman.h:232:12: note: previous declaration of 'madvise' was here 232 | extern int madvise(void *, size_t, int); | ^~~~~~~ ```
* Workaround for implicit declaration of function 'madvise' on SolarisNaohisa Goto2021-11-301-0/+8
| | | | | | | | On Solaris, madvise(3C) is NOT defined for SUS (XPG4v2) or later, but MADV_* macros are defined when __EXTENSIONS__ is defined. This may cause compile error on Solaris 10 with GCC when "-Werror=implicit-function-declaration" and "-D_XOPEN_SOURCE=600" are added by configure.
* rb_fiber_raise(): add doxygen卜部昌平2021-09-301-2/+2
| | | | Must not be a bad idea to improve documents.
* Expose `rb_fiber_raise` and tidy up the internal implementation.Samuel Williams2021-09-201-71/+94
|
* Suppress format-pedantic warningsNobuyoshi Nakada2021-09-021-4/+4
|
* Remove root_jmpbuf in rb_thread_structNobuyoshi Nakada2021-08-101-2/+0
| | | | It has not been used since 1b82c877dfa72e8505ded149fd0e3ba956529d3f.
* Remove unneeded rb_fiber_transfer_kw declarationS-H-GAMELINKS2021-08-071-2/+0
|
* Using RBOOL macroS.H2021-08-021-7/+2
|
* Adjust styles [ci skip]Nobuyoshi Nakada2021-07-181-2/+4
| | | | * --procnames-start-lines
* cont.c: fix formatting of RDoc for Fiber classKazuki Yamaguchi2021-07-171-2/+2
|
* Replace copy coroutine with pthread implementation.Samuel Williams2021-07-011-70/+71
|
* cont.c: Replace "iff" with "if and only if"nagachika2021-06-121-1/+1
|
* Suppress clobbered warnings on Travis-CI ppc64le-linuxNobuyoshi Nakada2021-06-031-1/+1
|
* Expose `rb_fiber_transfer` and `rb_fiber_transfer_kw`.Samuel Williams2021-06-031-3/+3
|
* Fix some typos by spell checkerRyuta Kamizono2021-04-261-2/+2
|
* Fix handling of timeout accessing scheduler outside of non-blocking context.Samuel Williams2021-03-301-0/+15
|
* fiber context update for Mac OS.David CARLIER2021-03-291-1/+11
| | | | | | | it is more about memory accounting sake. At allocation time, we make clear we re possibly reusing regions marked as reusable. Noted also calls might not necessarily succeed at first so we do only when necessary.
* solaris/illumos build fix.David Carlier2021-03-221-0/+2
|
* [DOC] some methods of Fiber do not need to require anymore [Feature #17407]Kazuhiro NISHIYAMA2021-03-221-8/+3
|
* Renamed functions for Fiber singleton methodsNobuyoshi Nakada2021-03-121-9/+8
|
* Constified variables for getenvNobuyoshi Nakada2021-03-121-1/+1
|
* rb_fiber_terminate never returnsNobuyoshi Nakada2021-02-241-2/+3
|
* Send :fiber_switch event for almost every fiber_switch (#4207)nicholas a. evans2021-02-221-18/+18
| | | | | | | | | | | | | | | | | | | With this patch, TracePoint receives a `:fiber_switch` event for _almost_ every fiber switch. Previously, it would not be sent when an exception was going to be raised. Now the event should only be blockable by an interrupt (including `Thread#raise`) or a fatal error. Additionally, interrupts will now be checked on the return fiber _before_ re-raising the terminating unhandled exception. And a fiber that terminates with an unhandled exception no longer creates a pending interrupt on its thread. The exception will be raised in the return fiber the same way as `Fiber#raise`: using `cont.value` with `cont.argc == -1` I moved `rb_exc_raise` from `fiber_store` to the end of `fiber_switch` after _all_ of the other cleanup code: `fiber_stack_release`, `th->blocking` increment, `RUBY_VM_CHECK_INTS`, and `EXEC_EVENT_HOOK`. It seems to me that skipping those other cleanup steps may have also resulted in other bugs.
* Expose scheduler as public interface & bug fixes. (#3945)Samuel Williams2021-02-091-7/+8
| | | | | | | | | * 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.
* Moved Fiber methods into core [Feature #17407]Nobuyoshi Nakada2021-01-131-11/+5
|
* [DOC] Fix grammar: "is same as" -> "is the same as"Marcus Stollsteimer2021-01-051-1/+1
|
* Adjusted styles [ci skip]Nobuyoshi Nakada2020-12-281-2/+4
|
* Language tweaks to Fiber [doc]Marc-Andre Lafortune2020-12-271-56/+49
|
* Fix a typo [ci skip]Kazuhiro NISHIYAMA2020-12-241-1/+1
|
* Redocument non-blocking Fibers and schedulerzverok2020-12-241-1/+339
| | | | | | | | | * Document Fiber's method related to scheduling; * Extend Fiber's class docs with concepts of non-blocking fibers; * Introduce "imaginary" (documentation-only) class Fiber::SchedulerInterface to properly document how scheduler's methods should look.
* Review commentszverok2020-12-241-3/+10
|
* Redocument Fiber#transferzverok2020-12-241-27/+53
|
* Enable `Fiber.current` and `Fiber#alive?` call inside ractorDelton Ding2020-12-231-0/+3
|
* Update Fiber#backtrace doc [See bug #17408]Marc-Andre Lafortune2020-12-211-2/+2
|
* Document Fiber#backtrace and #backtrace_locationszverok2020-12-211-0/+65
|
* Let Fiber#raise work with transferring fibersnicholas a. evans2020-12-121-4/+23
| | | | | | This automatically choosess whether to use transfer on a transferring fiber or resume on a yielding fiber. If the fiber is resuming, it raises a FiberError.
* Remove obsoleted internal/mjit.h inclusionTakashi Kokubun2020-11-221-1/+0
| | | | :bow:
* Make sure all threads are scanned on unload_unitsTakashi Kokubun2020-11-211-3/+6
| | | | | | | | | | | This has been a TODO since 79df14c04b. While adcf0316d1 covered the root_fiber of the initial thread, it didn't cover root_fibers of other threads. Now it's hooked properly in rb_threadptr_root_fiber_setup. With regards to "XXX: Is this mjit_cont `mjit_cont_free`d?", when rb_threadptr_root_fiber_release is called, although I'm not sure when th->root_fiber is truthy, fiber_free seems to call cont_free and mjit_cont_free. So mjit_conts of root_fibers seem to be freed properly.
* fix public interfaceKoichi Sasada2020-11-181-1/+1
| | | | | | | | | | | | | | | | | | To make some kind of Ractor related extensions, some functions should be exposed. * include/ruby/thread_native.h * rb_native_mutex_* * rb_native_cond_* * include/ruby/ractor.h * RB_OBJ_SHAREABLE_P(obj) * rb_ractor_shareable_p(obj) * rb_ractor_std*() * rb_cRactor and rm ractor_pub.h and rename srcdir/ractor.h to srcdir/ractor_core.h (to avoid conflict with include/ruby/ractor.h)
* strip trailing spaces and adjusted indents [ci skip]Nobuyoshi Nakada2020-11-121-13/+13
|
* Rename to `Fiber#set_scheduler`.Samuel Williams2020-11-071-3/+41
|
* Remove duplicated line [ci skip]Kazuhiro NISHIYAMA2020-10-141-1/+0
| | | | ref bf3b2a43741e4f72be21bc6acf24d37e7fcff61c
* relax Fiber#transfer's restrictionKoichi Sasada2020-10-121-35/+67
| | | | | | | | | | | | | | | | | | | | | | | | | Using Fiber#transfer with Fiber#resume for a same Fiber is limited (once Fiber#transfer is called for a fiber, the fiber can not be resumed more). This restriction was introduced to protect the resume/yield chain, but we realized that it is too much to protect the chain. Instead of the current restriction, we introduce some other protections. (1) can not transfer to the resuming fiber. (2) can not transfer to the yielding fiber. (3) can not resume transferred fiber. (4) can not yield from not-resumed fiber. [Bug #17221] Also at the end of a transferred fiber, it had continued on root fiber. However, if the root fiber resumed a fiber (and that fiber can resumed another fiber), this behavior also breaks the resume/yield chain. So at the end of a transferred fiber, switch to the edge of resume chain from root fiber. For example, root fiber resumed f1 and f1 resumed f2, transferred to f3 and f3 terminated, then continue from the fiber f2 (it was continued from root fiber without this patch).
* Fix a use-after-free bug reported by ASANAaron Patterson2020-10-011-3/+1
| | | | | | | If a fiber and thread are collected at the same time, the thread might get collected first and the pointer on the fiber will go bad. I don't think we need to check whether or not this is the main fiber in order to release its stack
* Make Mutex per-Fiber instead of per-ThreadBenoit Daloze2020-09-141-0/+11
| | | | | | | | | * 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]