simutrans
simutrans copied to clipboard
compile error on alpine linux
musl libc doesn't support PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP. the _NP at the end means "non portable". that means it shouldn't be used.
instead the portable way is
pthread_mutex_t Mutex;
pthread_mutexattr_t Attr;
pthread_mutexattr_init(&Attr);
pthread_mutexattr_settype(&Attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&Mutex, &Attr);
according to https://stackoverflow.com/questions/7037481/c-how-do-you-declare-a-recursive-mutex-with-posix-threads
i'm usign a bogus PR to report this issue, since "issues" are not available in this repo.
forgot the error msg
boden/wege/../../utils/simthread.h:27:48: error: 'PTHREAD_RECURSIVE_MUTEX_INITI$
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIAL$
^
boden/wege/../../utils/simthread.h:27:48: note: in definition of macro 'PTHREAD$
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIAL$