Skip to content

sync: add condition support#24574

Merged
spytheman merged 6 commits into
vlang:masterfrom
kbkpbot:add-sync-cond
May 29, 2025
Merged

sync: add condition support#24574
spytheman merged 6 commits into
vlang:masterfrom
kbkpbot:add-sync-cond

Conversation

@kbkpbot

@kbkpbot kbkpbot commented May 25, 2025

Copy link
Copy Markdown
Contributor

Just like go.Cond.

@huly-for-github

Copy link
Copy Markdown

Connected to Huly®: V_0.6-22939

@enghitalo

Copy link
Copy Markdown
Contributor

Why do you have an array of Channels?
If you are using Channels, why are you blocking the thread with a mutex?

@kbkpbot

kbkpbot commented May 25, 2025

Copy link
Copy Markdown
Contributor Author

Why do you have an array of Channels? If you are using Channels, why are you blocking the thread with a mutex?

  1. We can replace array of channels with array of semaphores. This is just for signal, broadcast working.
  2. By using channels, we can use select with timeout.
  3. Before enter wait, a user-defined mutex must be held.

Comment thread vlib/sync/cond_test.v Outdated
Comment thread vlib/sync/cond.v Outdated

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

@spytheman spytheman merged commit d6a2a5e into vlang:master May 29, 2025
70 checks passed
@kbkpbot kbkpbot deleted the add-sync-cond branch May 29, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants