File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,10 +41,10 @@ int sem_timedwait(sem_t* sem, const struct timespec* timeout)
4141#if defined(_WIN32) || defined(_WIN64)
4242Semaphore::Semaphore (std::int32_t count)
4343{
44- hSemaphore = OpenSemaphore (0 , false , nullptr );
44+ hSemaphore = OpenSemaphore (SEMAPHORE_ALL_ACCESS , false , nullptr );
4545 if (!hSemaphore)
4646 {
47- hSemaphore = CreateSemaphore (nullptr , count, count + 1 , nullptr );
47+ hSemaphore = CreateSemaphore (nullptr , count, LONG_MAX , nullptr );
4848 }
4949
5050 if (!hSemaphore)
@@ -55,10 +55,10 @@ Semaphore::Semaphore(std::int32_t count)
5555
5656Semaphore::Semaphore (const std::string &name, std::int32_t count)
5757{
58- hSemaphore = OpenSemaphore (0 , false , name.c_str ());
58+ hSemaphore = OpenSemaphore (SEMAPHORE_ALL_ACCESS , false , name.c_str ());
5959 if (!hSemaphore)
6060 {
61- hSemaphore = CreateSemaphore (nullptr , count, count + 1 , name.c_str ());
61+ hSemaphore = CreateSemaphore (nullptr , count, LONG_MAX , name.c_str ());
6262 }
6363
6464 if (!hSemaphore)
You can’t perform that action at this time.
0 commit comments