Skip to content

FIFOBuffer method semantics differ depending on calling task. #122

@samoconnor

Description

@samoconnor

The doc says "when reading from a FIFOBuffer, if accessed from the main task, it will not block if there are no bytes available to read, instead returning an empty UInt8[].
If being read from asynchronously, however, reading will block until additional bytes have been written."
.

I am concerned that this is a potential source of bugs that are difficult to track down.
Users may write some code where, at the time of writing, the FIFOBuffer is read from the same task that created it, and therefore sees non-blocking read behaviour. However, if the reading part of the code is made @async later for unrelated reasons the behaviour will change to blocking. e.g. the @timeout macro uses a task internally. So, if the user calls some convenience macro or function that internally uses a task they'll get unexpected behaviour.

Another possibility is that the user passes a result FIFOBuffer to something like parse_yaml_from_stream(::IO) -> Dict. The user may have no idea if this function uses a task internally or not. Or, the yaml library may change from using a task to not using a task.

The blocking behaviour should be consistent irrespective of the calling task.

Note that the branch referenced in #110 removes the task-specific blocking behaviour and still passes the test suite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions