Stop & start the world (undocumented API)#14729
Stop & start the world (undocumented API)#14729straight-shoota merged 8 commits intocrystal-lang:masterfrom
Conversation
|
Maybe it should be |
I think this makes sense, yes.
These are the Bohem specfic functions, right? why would they not be defined there? |
| SIGINFO = 29 | ||
| SIGWINCH = 28 | ||
| SIGRTMIN = 65 | ||
| SIGRTMAX = 126 |
There was a problem hiding this comment.
Let's note that SIGRTMIN and SIGRTMAX also exist on:
- Linux: but are functions:
__libc_current_sigrtmin()and__libc_current_sigrtmin(); - Solaris: but are calling sysconf:
_sysconf(_SC_SIGRT_MIN)and_sysconf(_SC_SIGRT_MAX); - NetBSD: but kernel only (not exposed to userland yet).
|
One VM on the AArch64 CI server was acting up. |
Thread is now the entrypoint for stopping the world. Delegating to the GC is an implementation detail. The `sig_resume` and `sig_suspend` properties are now set on Crystal::System::Thread and only for UNIX.
9c934d5 to
88d2be3
Compare
|
Rebased from |
Add
GC.stop_worldandGC.start_worldmethods to be able to stop and restart the world at will from within Crystal.GC_stop_world_externalandGC_start_world_external;My use case is a perf-tools feature for RFC 2 that must stop the world to print out runtime information of each ExecutionContext with their schedulers and fibers. See crystal-lang/perf-tools#18
Notes:
thread_suspend,thread_resumeandthread_get_statesyscalls that could be used instead of using signals;I'm having a hard time to articulate the relationship between GC and Thread on this feature.Thread#suspendfeels pretty neat but we need a couple signals on UNIX. For now I exposeGC.sig_suspendandGC.sig_resumebut they feel out of place 😞The entrypoints are now
Thread.start_worldandThread.stop_worldand sig suspend/resume are only defined on Crystal::System::Thread for UNIX.