1 // This may look like C code, but it is really -*- C++ -*- 2 // 3 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2003 4 // Copyright Dirk Lemstra 2014 5 // 6 // Definition of types and classes to support threads 7 // 8 // This class is a Magick++ implementation class and is not intended 9 // for use by end-users. 10 // 11 #if !defined (Magick_Thread_header) 12 #define Magick_Thread_header 13 14 #include "Magick++/Include.h" 15 16 #if defined(_VISUALC_) 17 #include <windows.h> 18 #endif // defined(_VISUALC_) 19 20 #if defined(MAGICKCORE_HAVE_PTHREAD) 21 # include <pthread.h> 22 #endif // defined(MAGICKCORE_HAVE_PTHREAD) 23 24 namespace Magick 25 { 26 // Mutex lock wrapper 27 class MagickPPExport MutexLock 28 { 29 public: 30 31 // Default constructor 32 MutexLock(void); 33 34 // Destructor 35 ~MutexLock(void); 36 37 // Lock mutex 38 void lock(void); 39 40 // Unlock mutex 41 void unlock(void); 42 43 private: 44 45 // Don't support copy constructor 46 MutexLock(const MutexLock& original_); 47 48 // Don't support assignment 49 MutexLock& operator=(const MutexLock& original ); 50 51 #if defined(MAGICKCORE_HAVE_PTHREAD) 52 pthread_mutex_t _mutex; 53 #endif 54 #if defined(_MT) && defined(_VISUALC_) 55 HANDLE _mutex; 56 #endif 57 }; 58 } 59 60 #endif // Magick_Thread_header 61