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

Last change on this file since 290 was 290, checked in by rbri, 11 years ago

PDF plugin: Poppler library updated to version 0.12.4

File size: 1.8 KB
Line 
1//========================================================================
2//
3// GooMutex.h
4//
5// Portable mutex macros.
6//
7// Copyright 2002-2003 Glyph & Cog, LLC
8//
9//========================================================================
10
11//========================================================================
12//
13// Modified under the Poppler project - http://poppler.freedesktop.org
14//
15// All changes made under the Poppler project to this file are licensed
16// under GPL version 2 or later
17//
18// Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net>
19//
20// To see a description of the changes please see the Changelog file that
21// came with your tarball or type make ChangeLog if you are building from git
22//
23//========================================================================
24
25#ifndef GMUTEX_H
26#define GMUTEX_H
27
28// Usage:
29//
30// GooMutex m;
31// gInitMutex(&m);
32// ...
33// gLockMutex(&m);
34//   ... critical section ...
35// gUnlockMutex(&m);
36// ...
37// gDestroyMutex(&m);
38
39#ifdef _WIN32
40
41#include <windows.h>
42
43typedef CRITICAL_SECTION GooMutex;
44
45#define gInitMutex(m) InitializeCriticalSection(m)
46#define gDestroyMutex(m) DeleteCriticalSection(m)
47#define gLockMutex(m) EnterCriticalSection(m)
48#define gUnlockMutex(m) LeaveCriticalSection(m)
49
50/* Lucide */
51#elif defined(OS2)
52
53#define INCL_DOS
54#include <os2.h>
55
56typedef HMTX GooMutex;
57
58#define gInitMutex(m) DosCreateMutexSem(NULL,m,0,FALSE)
59#define gDestroyMutex(m) DosCloseMutexSem(*m)
60#define gLockMutex(m) DosRequestMutexSem(*m,SEM_INDEFINITE_WAIT)
61#define gUnlockMutex(m) DosReleaseMutexSem(*m)
62
63#else // assume pthreads
64
65#include <pthread.h>
66
67typedef pthread_mutex_t GooMutex;
68
69#define gInitMutex(m) pthread_mutex_init(m, NULL)
70#define gDestroyMutex(m) pthread_mutex_destroy(m)
71#define gLockMutex(m) pthread_mutex_lock(m)
72#define gUnlockMutex(m) pthread_mutex_unlock(m)
73
74#endif
75
76#endif
Note: See TracBrowser for help on using the repository browser.