source: trunk/poppler/mypoppler/goo/GooMutex.h @ 257

Last change on this file since 257 was 250, checked in by Eugene Romanenko, 13 years ago

PDF plugin: poppler library updated to version 0.8.3

File size: 1.3 KB
Line 
1//========================================================================
2//
3// GooMutex.h
4//
5// Portable mutex macros.
6//
7// Copyright 2002-2003 Glyph & Cog, LLC
8//
9//========================================================================
10
11#ifndef GMUTEX_H
12#define GMUTEX_H
13
14// Usage:
15//
16// GooMutex m;
17// gInitMutex(&m);
18// ...
19// gLockMutex(&m);
20//   ... critical section ...
21// gUnlockMutex(&m);
22// ...
23// gDestroyMutex(&m);
24
25#ifdef WIN32
26
27#include <windows.h>
28
29typedef CRITICAL_SECTION GooMutex;
30
31#define gInitMutex(m) InitializeCriticalSection(m)
32#define gDestroyMutex(m) DeleteCriticalSection(m)
33#define gLockMutex(m) EnterCriticalSection(m)
34#define gUnlockMutex(m) LeaveCriticalSection(m)
35
36#elif defined(OS2)
37
38#define INCL_DOS
39#include <os2.h>
40
41typedef HMTX GooMutex;
42
43#define gInitMutex(m) DosCreateMutexSem(NULL,m,0,FALSE)
44#define gDestroyMutex(m) DosCloseMutexSem(*m)
45#define gLockMutex(m) DosRequestMutexSem(*m,SEM_INDEFINITE_WAIT)
46#define gUnlockMutex(m) DosReleaseMutexSem(*m)
47
48#else // assume pthreads
49
50#include <pthread.h>
51
52typedef pthread_mutex_t GooMutex;
53
54#define gInitMutex(m) pthread_mutex_init(m, NULL)
55#define gDestroyMutex(m) pthread_mutex_destroy(m)
56#define gLockMutex(m) pthread_mutex_lock(m)
57#define gUnlockMutex(m) pthread_mutex_unlock(m)
58
59#endif
60
61#endif
Note: See TracBrowser for help on using the repository browser.