24 |
# define _GNU_SOURCE 1 /* so _XOPEN_SOURCE will be defined by features.h */ |
# define _GNU_SOURCE 1 /* so _XOPEN_SOURCE will be defined by features.h */ |
25 |
#endif |
#endif |
26 |
|
|
27 |
#include <features.h> |
#if defined(HAVE_FEATURES_H) && (HAVE_FEATURE != 0) |
28 |
|
# include <features.h> |
29 |
|
#endif |
30 |
|
|
31 |
#if !defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 500 |
#if !defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 500 |
32 |
# undef _XOPEN_SOURCE |
# undef _XOPEN_SOURCE |
44 |
|
|
45 |
Mutex::Mutex() { |
Mutex::Mutex() { |
46 |
// the following function call only works on UNIX98 compatible systems |
// the following function call only works on UNIX98 compatible systems |
47 |
|
#if (_XOPEN_SOURCE > 500) |
48 |
if (pthread_mutexattr_settype(&__posix_mutexattr, PTHREAD_MUTEX_ERRORCHECK)) { |
if (pthread_mutexattr_settype(&__posix_mutexattr, PTHREAD_MUTEX_ERRORCHECK)) { |
49 |
std::cout << "Mutex Constructor: Fatal error - unable to pthread_mutexattr_settype(PTHREAD_MUTEX_ERRORCHECK)\n" << std::flush; |
std::cout << "Mutex Constructor: Fatal error - unable to pthread_mutexattr_settype(PTHREAD_MUTEX_ERRORCHECK)\n" << std::flush; |
50 |
exit(-1); |
exit(-1); |
51 |
} |
} |
52 |
|
#endif |
53 |
pthread_mutex_init(&__posix_mutex, &__posix_mutexattr); |
pthread_mutex_init(&__posix_mutex, &__posix_mutexattr); |
54 |
} |
} |
55 |
|
|