-
Notifications
You must be signed in to change notification settings - Fork 11
Add overwrite
option to channel send to enable ring-buffer like behavior
#82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
I sorta like Claude gives me:
|
6f84519
to
3b4e858
Compare
In some cases it's useful to have a channel which acts as a ring-buffer that overwrites the oldest data.
For example in UIs you often want the last mouse input. The alternatives like calling
tryRecv
and thensend
require taking the lock multiple times and adds odd edge-cases.Alternatively this could be made into a new proc
sendOverwrite
orforceSend
assend(ch, val, overwrite=true)
is no longer blocking in a sense.