-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
jl_yield() C API #6006
Comments
|
Great! I tried it and it works like a charm. The only issue is that the text is only updated every two lines in IJulia, but I suppose that is a different issue related to IJulia itself. An example library call below for future reference
To test, compile as library, then ccall() it from julia. |
Most likely it is grouping the outputs because there are multiple tasks running: the IJulia event loop as well as a task for outputting stdout and another for outputting stderr, for example. When you call In general, I would tend to call |
It would be nice to have a
jl_yield()
function in the C API, equivalent toyield()
in Julia, so that long-running C programs could give some cycles to the Julia event loop (see e.g. JuliaLang/IJulia.jl#153 or JuliaPy/PyPlot.jl#41 for why this is important even if you just want occasional status updates to be user-visible).@cbecker mentioned that he tried
jl_eval_string("yield()")
, but that it crashed Julia upon return. @JeffBezanson, is there something special that needs to be done in order toyield
inside of accall
?The text was updated successfully, but these errors were encountered: