/[svn]/linuxsampler/trunk/src/common/Mutex.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/common/Mutex.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 289 by schoenebeck, Tue Oct 19 14:41:38 2004 UTC revision 830 by persson, Sun Jan 15 18:23:11 2006 UTC
# Line 20  Line 20 
20   *   MA  02111-1307  USA                                                   *   *   MA  02111-1307  USA                                                   *
21   ***************************************************************************/   ***************************************************************************/
22    
23    #ifdef HAVE_CONFIG_H
24    # include <config.h>
25    #endif
26    
27  #ifndef _GNU_SOURCE  #ifndef _GNU_SOURCE
28  # 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 */
29  #endif  #endif
30    
31  #include <features.h>  #ifdef HAVE_FEATURES_H
32    # include <features.h>
33    #endif
34    
35  #if !defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 500  #if !defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 500
36  # undef _XOPEN_SOURCE  # undef _XOPEN_SOURCE
37  # define _XOPEN_SOURCE 500 /* to define PTHREAD_MUTEX_ERRORCHECK */  # define _XOPEN_SOURCE 500 /* to define PTHREAD_MUTEX_ERRORCHECK */
38  # warning Seems you don't have a UNIX98 compatible system.  # warning "Seems you don't have a UNIX98 compatible system."
39  # warning Please run LinuxSampler's selftest to make sure this won't oppose a problem!  # warning "Please run LinuxSampler's selftest to make sure this won't be a problem!"
40  # warning (compile tests with 'make tests', run them with 'src/testcases/linuxsamplertest')  # warning "(compile tests with 'make tests', run them with 'src/testcases/linuxsamplertest')"
41  #endif  #endif
42    
43  #include <iostream>  #include <iostream>
# Line 42  Line 48 
48    
49  Mutex::Mutex() {  Mutex::Mutex() {
50      // the following function call only works on UNIX98 compatible systems      // the following function call only works on UNIX98 compatible systems
51        #if (_XOPEN_SOURCE > 500)
52      if (pthread_mutexattr_settype(&__posix_mutexattr, PTHREAD_MUTEX_ERRORCHECK)) {      if (pthread_mutexattr_settype(&__posix_mutexattr, PTHREAD_MUTEX_ERRORCHECK)) {
53          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;
54          exit(-1);          exit(-1);
55      }      }
56        #endif
57      pthread_mutex_init(&__posix_mutex, &__posix_mutexattr);      pthread_mutex_init(&__posix_mutex, &__posix_mutexattr);
58  }  }
59    

Legend:
Removed from v.289  
changed lines
  Added in v.830

  ViewVC Help
Powered by ViewVC