-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop & start the world (undocumented API) #14729
Stop & start the world (undocumented API) #14729
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_world
andGC.start_world
methods to be able to stop and restart the world at will from within Crystal.GC_stop_world_external
andGC_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_resume
andthread_get_state
syscalls 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#suspend
feels pretty neat but we need a couple signals on UNIX. For now I exposeGC.sig_suspend
andGC.sig_resume
but they feel out of place 😞The entrypoints are now
Thread.start_world
andThread.stop_world
and sig suspend/resume are only defined on Crystal::System::Thread for UNIX.