[QUERY] Help With Semaphore Error on Windows : Cygwin

Takashi Yano takashi.yano@nifty.ne.jp
Fri Feb 17 08:52:37 GMT 2023


On Fri, 17 Feb 2023 12:56:06 +0800
Yeo Kai Wei wrote:
> Hi All,
> 
> Thanks for the help.
> 
> It works now.
> 
> So, the 2 things that were required
> 
> 1. Adding the '/' in front of the semaphore name so that Cygwin can 
> recognise it
> 
> #define SemaphoreName "/mysemaphore"
> 
> 2. Changing the if check from if(semptr == (void*) -1) to if(semptr == 
> (sem_t*) 0)

No. You should use:
  if (semptr == SEM_FAILED)

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


More information about the Cygwin mailing list