-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorneeds decisionA decision on this change is neededA decision on this change is needed
Description
Currently, a ctrl-c in the REPL can interrupt a ccall
to an external library, leaving that library in an inconsistent state and producing crashes or other problems later (see e.g. PyCall issue #15).
Julia's C API (julia.h
) has SIGATOMIC
macros to protect critical code regions from being interrupted by ctrl-c (SIGINT
), but these are not easily accessible from Julia.
Arguably, every ccall
should be made sigatomic by default, on the theory that C code in general is not interrupt-safe (with a separate interruptable_ccall
for cases that are known to be re-entrant and interrupt-safe). Note that Python does the same thing. As noted below, the performance penalty for this is almost certainly negligible under ordinary circumstances.
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorneeds decisionA decision on this change is neededA decision on this change is needed