Skip to content

Offer a version of put that can run multiple times #51

@treeowl

Description

@treeowl

There are some pretty reasonable situations where it makes sense to allow multiple threads to race to fill the same IVar. Currently, that programming model is prohibited. The lvish package provides limited support by using == to test for equality on a second put. I think this seems an eminently reasonable thing to do. I also think it would also make sense to offer an "unsafe" version that simply does nothing when the IVar is full. I think implementation probably shouldn't be too terrible; one way would be to change the Put constructor to

           | forall a . Put (IVar a) a (Bool -> Trace)

This informs the continuation of whether the IVar was already full.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions