Skip to content

formalize waiting on multiple conditions #6563

Closed
@vtjnash

Description

@vtjnash

in poll_fd, we see one pattern for waiting on multiple conditions, I propose the following simplification based upon chaining of Condition variables:

wait( cond1 | (cond2 & cond3 & !cond4))

=> returns when either cond1 has occurred, or (both cond2 and cond3 have occurred, but cond4 has not occurred)

pseudo implementation:

immutable OrCondition <: Condition; a::Condition; b::Condition; end
immutable AndCondition <: Condition; a::Condition; b::Condition; end
immutable NotCondition <: Condition; a::Condition end
&(a::Condition, b::Condition) = OrCondition(a,b)
|(a::Condition, b::Condition) = AndCondition(a,b)
!(a::Condition) = NotCondition(a)
wait(::OrCondition) = return (wait(a)) or (wait(b)) based upon whichever one occurred
wait(::AndCondition) = return (wait(a), wait(b)) as a tuple

Metadata

Metadata

Assignees

No one assigned

    Labels

    julepJulia Enhancement Proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions