I’m calling some C code many times in a loop, and I expect it to spend a lot of its time blocked. To let other Julia tasks take control while my C code is blocked I’m using @spawn
, then fetch
ing the result:
fetch(Threads.@spawn ccall(...))
(This is basically the same as @threadcall
but I’m under the impression that is deprecated so I’m trying to use the latest-and-greatest. I see similar but not identical strange behavior when using @threadcall
)
I’m having some issues where Ctrl-C
seems to be crashing, and I suspect that it might be because the C code is being interrupted in the middle of the ccall
and left in an inconsistent state. From #16174 it looks like all ccall
s should be sigatomic, but I’m wondering - has anything has changed in that respect with the recent threading support?
Wrapping my ccall
in a disable_sigint() do ... end
block seems to solve the problem, which supports that maybe this is the issue.