On Thu, 16 Feb 2023 12:04:01 +0800 Yeo Kai Wei wrote: > Hi All, > > Could I request for some help on some code? > > I ran into an error with semaphores with some book code using Cygwin on > Windows. > > The code will throw an error with sem_post(). > > I compiled it with gcc -o memwriter memwriter.c -lrt -lpthread > > $ ./memwriter > Shared memory address: 0x6fffffff0000 [0..511] > backing file: /dev/shm/shMemEx > semptr is address 0x7ffffcc18 with value 0 > SEM_VALUE_MAX is 1147483648 > sem_post: Invalid argument <--------------------------- ERROR > > > According to feedback, the above error does not turn up on Linux. > > May I know if this is supposed to happen on Cygwin on Windows? > > If not, how can I solve this? > > I've also attached the code for reference.
Semaphore name which does not begin with slash (/) is not portable. See: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_open.html Cygwin disallows that. -- Takashi Yano <takashi.y...@nifty.ne.jp> -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple