Skip to content

read(s::IOStream, T::Union{Type{Int16},Type{UInt16}...}) doesn't respect ;lock = false #42393

Closed
@Moelf

Description

@Moelf

@_lock_ios is used to skip lock() when a IOStream was opened with open(; lock=false)

julia/base/iostream.jl

Lines 396 to 399 in fc02458

function read(s::IOStream, ::Type{UInt8})
b = @_lock_ios s ccall(:ios_getc, Cint, (Ptr{Cvoid},), s.ios)
if b == -1
throw(EOFError())

But reading non-UInt8 types seem to always lock the file regardless:

julia/base/iostream.jl

Lines 405 to 408 in fc02458

function read(s::IOStream, T::Union{Type{Int16},Type{UInt16},Type{Int32},Type{UInt32},Type{Int64},Type{UInt64}})
n = sizeof(T)
lock(s.lock)
if ccall(:jl_ios_buffer_n, Cint, (Ptr{Cvoid}, Csize_t), s.ios, n) != 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions