Including semaphore.h fails with an error about missing mode_t. The problem can be exhibited with
#include <semaphore.h>
int main()
{
return 0;
}
Various work-arounds are possible. Including sys/stat.h before semaphore.h seems to provide the required definition.
This was reported as a problem when building Poly/ML on Mingw. It uses autoconf to detect the header files and includes semaphore.h if it is
present. It does not actually use semaphores on native Windows, instead using native Windows functions so I have worked around this by only
including semaphore.h if it going to be used.
David Matthews
This bug report belongs to pthreads-win32.
<quote file=semaphore.h>
/*
* Module: semaphore.h
*
* Purpose:
* Semaphores aren't actually part of the PThreads standard.
* They are defined by the POSIX Standard:
*
* POSIX 1003.1b-1993 (POSIX.1b)
*
* --------------------------------------------------------------------------
*
* Pthreads-win32 - POSIX Threads Library for Win32
</quote>
However, I question whether or not these headers should be included in /mingw/include instead of /mingw/include/vendor directory? I've assigned to Cesar since these are included by installing GCC.
The _mode_t data type is defined in sys/types.h and should be included by semaphore.h which is the bug.
Any comment Cesar?