Hello Daniel, > PTHREAD ENVIRONMENT > > z/OS has effectively two major pthread interfaces: _OPEN_THREADS, and > _UNIX95_THREADS. The latter is the one you want to use, because its API > is compatible with other systems. (_OPEN_THREADS uses e.g. a different > signature for pthread_getspecific() that comes from a draft POSIX > specification; refer to > > > https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.4.0/com.ibm.zos.v2r4.bpxbd00/ptgetsp.htm > > for the gory details. pthread_detach() is different, too, and > pthread_cond_timedwait() can return EAGAIN.) > > Additional information on z/OS feature test macros, if desired: > > > https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.4.0/com.ibm.zos.v2r4.bpxbd00/ftms.htm > > More specifically, to get a suitable pthreads interface, you need to > #define _UNIX95_THREADS and _XOPEN_SOURCE=600.
I'd suggest to add this to the recommended values of CC and CXX in https://gitlab.com/ghwiki/gnow-how/wikis/Platforms/Configuration > (This could perhaps be > added to AC_USE_SYSTEM_EXTENSIONS for this system.) I'm not sure adding these flags in AC_USE_SYSTEM_EXTENSIONS or gl_USE_SYSTEM_EXTENSIONS would work for all packages. For the majority, probably yes, but for all of them? Not sure. > However, one annoyance of _UNIX95_THREADS is that it does not define > PTHREAD_RWLOCK_INITIALIZER, supposedly because the SUSv3 standard (which > is what that feature test macro requests) does not specify it. However, > IBM does provide the "implementation-defined" > PTHREAD_RWLOCK_INITIALIZER_NP, which can be used in its place. See the > note here: > > > https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.4.0/com.ibm.zos.v2r4.bpxbd00/rp0r0i.htm > > I would thus suggest adding something like the following to > lib/pthread.in.h: > > #if defined(__MVS__) && !defined(PTHREAD_RWLOCK_INITIALIZER) > # define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER_NP > #endif Tell the package maintainers to import the gnulib module 'pthread-rwlock'. It will deal with the missing PTHREAD_RWLOCK_INITIALIZER; this issue occurs also on some older Solaris versions. Bruno