Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
In CLRLifoSemaphore, start the underlying semaphore with 0 for the in…
Browse files Browse the repository at this point in the history
…itial signal count (#22632)

- Port of a fix from dotnet/corert#6955
- The underlying semaphore is only used to wake up waiters, initially there are no waiters and the signal count should be zero. This was already the case on Windows, this fixes the Unix side. The actual initial signal count is tracked in the upper layer counts.
- The initial signal count passed in is zero anyway in the places where it's used, so it makes no difference for now, just some cleanup
  • Loading branch information
kouvel authored and stephentoub committed Mar 15, 2019
1 parent 5231179 commit 9c4d496
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/vm/synch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ void CLRLifoSemaphore::Create(INT32 initialSignalCount, INT32 maximumSignalCount
_ASSERTE(m_handle == nullptr);

#ifdef FEATURE_PAL
HANDLE h = UnsafeCreateSemaphore(nullptr, initialSignalCount, maximumSignalCount, nullptr);
HANDLE h = UnsafeCreateSemaphore(nullptr, 0, maximumSignalCount, nullptr);
#else // !FEATURE_PAL
HANDLE h = CreateIoCompletionPort(INVALID_HANDLE_VALUE, nullptr, 0, maximumSignalCount);
#endif // FEATURE_PAL
Expand Down

0 comments on commit 9c4d496

Please sign in to comment.