Skip to content
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

doc: improve explanation of unsafety for atomic mode #4876

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mflatt
Copy link
Member

@mflatt mflatt commented Dec 18, 2023

Closes #4858

@LiberalArtist
Copy link
Contributor

I don't recall many specific questions offhand, but I know I have sometimes felt unclear about the distinctions (if any) between atomic mode and some other sets of restrictions (most of which include atomic mode) related to ffi/unsafe:

  • #:async-apply arguments to _cprocedure or _fun
  • callbacks created with #:atomic #t—are these additional restrictions, or just further examples of the restrictions of atomic mode?

    In addition, the Racket code must not perform any potentially blocking operation (such as I/O), it must not raise an uncaught exception unless called through a callout that supports exception (with #:callback-exns? #t), it must not perform any escaping continuation jumps, and (at least for the BC implementation) its non-tail recursion must be minimal to avoid C-level stack overflow; otherwise, the process may crash or misbehave.

  • Functions called in an unspecified Racket thread, e.g. the callback for register-custodian-shutdown
  • Finalizers for register-finalizer
  • Functions used with call-in-os-thread

@shhyou shhyou linked an issue Dec 26, 2023 that may be closed by this pull request
@shhyou shhyou added the documentation Issues related to README and documentation (typos, rewording, new docs, etc) label Dec 26, 2023
@mflatt
Copy link
Member Author

mflatt commented Jan 1, 2024

I agree that more is needed here. For example, there's some duplication in the description of #:atomic, but there are also additional restrictions about escaping and C-level overflow in that context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issues related to README and documentation (typos, rewording, new docs, etc)
Projects
None yet
3 participants