Skip to content

Thread wait timeouts break on negative, NaN, huge and sub-millisecond values #122

Closed

Description

@dimensionscape
  • POSIX Semaphore.tryAcquire builds a negative tv_nsec for negative or NaN timeouts and overflows (int) for large ones, so -0.5, NaN, 3e9 and 1e10 throw "Failed to wait for semaphore" (Windows returns false/true). It also reads errno after leaving the GC-free zone.
  • With a 32-bit time_t, WaitSeconds(3e9) overflows tv_sec and returns after microseconds, so Lock.wait spins at full CPU.
  • Windows truncates milliseconds instead of rounding up, so tryAcquire(0.0005) does not wait and Lock.wait busy-polls the last millisecond of every timed wait.

Activity

  1. added this to the 6.0.0 milestone on Oct 15, 2026
  2. added a commit that references this issue on Oct 15, 2026
    3447190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions