Hi all
How can sleep(0.001)
error?
┌ Error:
│ EOFError: read end of file
│ Stacktrace:
│ [1] wait
│ @ .\asyncevent.jl:159 [inlined]
│ [2] sleep
│ @ .\asyncevent.jl:265 [inlined]
This happend on Windows. Julia v10.0.0
Thanks all!
Hi all
How can sleep(0.001)
error?
┌ Error:
│ EOFError: read end of file
│ Stacktrace:
│ [1] wait
│ @ .\asyncevent.jl:159 [inlined]
│ [2] sleep
│ @ .\asyncevent.jl:265 [inlined]
This happend on Windows. Julia v10.0.0
Thanks all!
Please post a minimal working snippet of code that triggers this error for you. Please read: make it easier to help you
Hard to give a minimal working snippet. Just can tell that it happens almost never (my feeling 1 in 10^15).
The surrounding code is a while-true
with a inner try-catch
and a pulling ccall
. All this runs in a separate task.
It shouldn’t be hard to share the code you’re actually trying to run. You only showed a partial error message.
I can do that… But I have to remove company code. But the following function gets spawned in at task.
function get_next_item()
while _IS_RUNNING[]
try
return_buffer = managed_allocating_ccall(
ccall_get_next_item
)
if isnothing(return_buffer)
sleep(0.001)
continue
end
distribute_to_channels(
deserialize_item(return_buffer)...
)
catch e
@error(
sprint(showerror, e, catch_backtrace())
)
end
end
end
and
function managed_allocating_ccall(allocating_ccall::Function)::Union{IOBuffer, Nothing}
(return_value_ptr, return_value_length) = allocating_ccall()
if return_value_ptr == Ptr{UInt8}()
return nothing
end
return_value_length_buffer = IOBuffer(return_value_length)
return_value_length = read(return_value_length_buffer, Int32)
return_value = unsafe_wrap(Vector{UInt8}, return_value_ptr, return_value_length)
return_value = deepcopy(return_value)
ccall_free(return_value_ptr)
return IOBuffer(return_value)
end
and
function ccall_get_next_item()
return_value_length = zeros(UInt8, 4)
return_value_ptr = @my_semaphore_lock begin
GC.@preserve return_value_length begin
@ccall $C_ABI_POINTER_GET_NEXT_ITEM(
pointer(return_value_length)::Ptr{UInt8},
)::Ptr{UInt8}
end
end with Semaphore _CCALL_SEMAPHORE
(return_value_ptr, return_value_length)
end