#if !defined (Magick_Thread_header)
#define Magick_Thread_header
#include "Magick++/Include.h"
#if defined(_VISUALC_)
#include <windows.h>
#if defined(_MT)
struct win32_mutex {
HANDLE id;
};
#define MAXSEMLEN 1
#endif
#endif
#if defined(MAGICKCORE_HAVE_PTHREAD)
# include <pthread.h>
#endif
namespace Magick
{
class MagickPPExport MutexLock
{
public:
MutexLock(void);
~MutexLock(void);
void lock(void);
void unlock(void);
private:
MutexLock ( const MutexLock& original_ );
MutexLock& operator = ( const MutexLock& original_ );
#if defined(MAGICKCORE_HAVE_PTHREAD)
pthread_mutex_t _mutex;
#endif
#if defined(_MT) && defined(_VISUALC_)
win32_mutex _mutex;
#endif
};
class MagickPPExport Lock
{
public:
Lock( MutexLock *mutexLock_ );
~Lock( void );
private:
Lock ( const Lock& original_ );
Lock& operator = ( const Lock& original_ );
MutexLock* _mutexLock;
};
}
inline Magick::Lock::Lock( MutexLock *mutexLock_ )
: _mutexLock(mutexLock_)
{
_mutexLock->lock();
}
inline Magick::Lock::~Lock( void )
{
_mutexLock->unlock();
_mutexLock=0;
}
#endif