-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 07.11.2013 22:34, LRN wrote: > On 07.11.2013 22:00, Edscott Wilson wrote: >> Ok. So I now I ran more tests. To start with, I replaced the >> unnamed process-shared semaphore for a more compatible named >> semaphore, which by definition is process-shared. The code works >> fine in Linux and FreeBSD. But in MinGW-w64, no such luck. > >> I tried the toolchain in *mingw-w64-v3.0.0.tar.bz2, >> <https://sourceforge.net/projects/mingw-w64/files/latest/download?source=files>* > >> > > and the one in x86_64-4.8.2-release-posix-seh-rt_v3-rev0.7z and the > one in >> x86_64-4.8.2-release-win32-seh-rt_v3-rev0.7z, all with the same >> results on the following code: > > >> sem_t *sem = sem_open(sem_name, O_CREAT|O_EXCL, 0700, 0); if >> (sem == SEM_FAILED) { fprintf(stderr, "***Cannot create named >> semaphore: %s(%s)\n", sem_name, strerror(errno)); return 0; } > >> Which produces: > >> ***Cannot create named semaphore: \Tubo-1300-1-stdout (Function >> not implemented) > >> So my guess is that unnamed semaphores are not implemented >> either, because when I try to use them, I invariably get a crash >> (instead of the graceful exit shown above). > > This is the implementation of sem_open in winpthreads: > > sem_t * sem_open (const char *name, int oflag, mode_t mode, > unsigned int value) { sem_result (ENOSYS); return NULL; } > > So no one even attempted to implement semaphore opening in any way > (not just shared semaphore opening). It doesn't mean it's > impossible though. > >
Now that i've read the sem_init() source code in winpthreads carefully, i see that sem_init fails with EPERM if pshared is not PTHREAD_PROCESS_PRIVATE (which is defined as 0). Which means that shared semaphores support was not implemented even at initialization part. Sorry. - -- O< ascii ribbon - stop html email! - www.asciiribbon.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (MingW32) iQEcBAEBAgAGBQJSe95MAAoJEOs4Jb6SI2CwV6cH/jwqrdnbfypvKEaIFzBijifQ qiu694u/LCoUcxOK9ih5LBp/LwK9ydBSAZqcMPz7lkYTYdVb/ZEkucPxkUa1kWA0 /Ed+u8lUwjo3/HstmWcIbU6CVCN3r5ebj7R0bkZaH13ioC+A37aUYPQHb5kVzBeD 1Gs/X0F2OLrvLpdFCsYhCttQVTg0mOv/wKd7lLzA7XbpiD6AxfDOJjoSo5iTDF5u qyGK8YkF6VnYMjwcS2UIYYwmLEDXhW7bEO3E1h3nZMNFc7tC4AWWKQEp6iq280MO g+u9goRF0WlENBUSox/8apRlRd1mwWrjxFELpJ96Q1tiRLzmB5ZHoREIVYEkJ4E= =lnfb -----END PGP SIGNATURE----- ------------------------------------------------------------------------------ November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public