~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/poppler/goo/GooMutex.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
43
typedef 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
#else // assume pthreads
 
51
 
 
52
#include <pthread.h>
 
53
 
 
54
typedef pthread_mutex_t GooMutex;
 
55
 
 
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)
 
60
 
 
61
#endif
 
62
 
 
63
#endif