Skip to content
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

[std/channels] change the order of signal and unlock #17717

Merged
merged 1 commit into from
Apr 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/std/channels.nim
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ proc sendUnbufferedMpmc(chan: ChannelRaw, data: sink pointer, size: int, nonBloc

chan.head = 1

release(chan.headLock)
signal(chan.notEmptyCond)
release(chan.headLock)
result = true

proc sendMpmc(chan: ChannelRaw, data: sink pointer, size: int, nonBlocking: bool): bool =
Expand Down Expand Up @@ -343,8 +343,8 @@ proc sendMpmc(chan: ChannelRaw, data: sink pointer, size: int, nonBlocking: bool
if chan.tail == 2 * chan.size:
chan.tail = 0

release(chan.tailLock)
signal(chan.notEmptyCond)
release(chan.tailLock)
result = true

proc recvUnbufferedMpmc(chan: ChannelRaw, data: pointer, size: int, nonBlocking: bool): bool =
Expand All @@ -368,8 +368,8 @@ proc recvUnbufferedMpmc(chan: ChannelRaw, data: pointer, size: int, nonBlocking:

chan.head = 0

release(chan.headLock)
signal(chan.notFullCond)
release(chan.headLock)
result = true

proc recvMpmc(chan: ChannelRaw, data: pointer, size: int, nonBlocking: bool): bool =
Expand Down Expand Up @@ -404,8 +404,8 @@ proc recvMpmc(chan: ChannelRaw, data: pointer, size: int, nonBlocking: bool): bo
if chan.head == 2 * chan.size:
chan.head = 0

release(chan.headLock)
signal(chan.notFullCond)
release(chan.headLock)
result = true

proc channelCloseMpmc(chan: ChannelRaw): bool =
Expand Down