1
//========================================================================
5
// Portable mutex macros.
7
// Copyright 2002-2003 Glyph & Cog, LLC
9
//========================================================================
11
//========================================================================
13
// Modified under the Poppler project - http://poppler.freedesktop.org
15
// All changes made under the Poppler project to this file are licensed
16
// under GPL version 2 or later
18
// Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net>
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
23
//========================================================================
34
// ... critical section ...
43
typedef CRITICAL_SECTION GooMutex;
45
#define gInitMutex(m) InitializeCriticalSection(m)
46
#define gDestroyMutex(m) DeleteCriticalSection(m)
47
#define gLockMutex(m) EnterCriticalSection(m)
48
#define gUnlockMutex(m) LeaveCriticalSection(m)
50
#else // assume pthreads
54
typedef pthread_mutex_t GooMutex;
56
#define gInitMutex(m) pthread_mutex_init(m, NULL)
57
#define gDestroyMutex(m) pthread_mutex_destroy(m)
58
#define gLockMutex(m) pthread_mutex_lock(m)
59
#define gUnlockMutex(m) pthread_mutex_unlock(m)