You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I currently use IOCapture as follows and it works well:
try
captured = IOCapture.capture() doinclude_string(...)
end# ... processing of captured ...catch e
# ...end
I'd like to be able to do this in a multi-threaded context where these calls potentially happen on separate threads. I can add a ReentrantLock and do
lock(l)
try
captured[k] = IOCapture.capture() do...endcatch...finallyunlock(l)
end
but this amounts to doing these evaluations sequentially as far as I understand. Is there a better way to capture output of separate threads with IOCapture?
Thanks
Note: I also asked this question in the Suppressor repo (JuliaIO/Suppressor.jl#45) not sure which one of the two would be more amenable to doing this.
The text was updated successfully, but these errors were encountered:
Under the hood, both IOCapture and Suppressor work basically the same way, so I think they're equally amenable. The basic workhorses are the redirect_stdout and redirect_stderr functions, but I am not sure how well they handle being called from separate threads in parallel. But it would be nice if IOCapture would just work in a multihreaded context.
Hello,
I currently use IOCapture as follows and it works well:
I'd like to be able to do this in a multi-threaded context where these calls potentially happen on separate threads. I can add a ReentrantLock and do
but this amounts to doing these evaluations sequentially as far as I understand. Is there a better way to capture output of separate threads with IOCapture?
Thanks
Note: I also asked this question in the Suppressor repo (JuliaIO/Suppressor.jl#45) not sure which one of the two would be more amenable to doing this.
The text was updated successfully, but these errors were encountered: