Skip to content

Race condition in leadingDebounce implementation #1027

@mkleczek

Description

@mkleczek

Nothing -> void $ tryPutMVar trigger ()

There is a small chance trigger is lost:

  1. Thread executing action checks for trigger and finds nothing
  2. Another thread reads baton and finds nothing
  3. Thread 1 sets baton and exits action loop
  4. Thread 2 sets trigger and exists.

Result: trigger is set but no action thread is running

The solution:
Set trigger unconditionally before checking for baton.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions