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