Skip to content

The condition variables API is incomplete #7998

@zah

Description

@zah

At the moment Nim offers just a pair of signal and wait APIs for its condition variables:
https://github.com/nim-lang/Nim/blob/master/lib/core/locks.nim#L5

In other programming languages there are separate calls such as notifyOne, notifyAll or even notify(n) when signalling the condition:

https://en.cppreference.com/w/cpp/thread/condition_variable
https://docs.python.org/3/library/asyncio-sync.html#asyncio.Condition

Furthermore, perhaps async options may be provided over the same underlying OS primitives. @cheatfate should be able to comment on this as he has implemented similar APIs in his asynctools repo.

The threadpool module defines additional primives such as a Semaphore which are currently not exported. I think these can be moved to the locks module and exported.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions