OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2007 Chris Wilson | 2 * Copyright © 2007 Chris Wilson |
3 * Copyright © 2009,2010 Red Hat, Inc. | 3 * Copyright © 2009,2010 Red Hat, Inc. |
4 * Copyright © 2011,2012 Google, Inc. | 4 * Copyright © 2011,2012 Google, Inc. |
5 * | 5 * |
6 * This is part of HarfBuzz, a text shaping library. | 6 * This is part of HarfBuzz, a text shaping library. |
7 * | 7 * |
8 * Permission is hereby granted, without written agreement and without | 8 * Permission is hereby granted, without written agreement and without |
9 * license or royalty fees, to use, copy, modify, and distribute this | 9 * license or royalty fees, to use, copy, modify, and distribute this |
10 * software and its documentation for any purpose, provided that the | 10 * software and its documentation for any purpose, provided that the |
(...skipping 29 matching lines...) Expand all Loading... |
40 /* We need external help for these */ | 40 /* We need external help for these */ |
41 | 41 |
42 #if 0 | 42 #if 0 |
43 | 43 |
44 | 44 |
45 #elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__)) | 45 #elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__)) |
46 | 46 |
47 #include <windows.h> | 47 #include <windows.h> |
48 typedef CRITICAL_SECTION hb_mutex_impl_t; | 48 typedef CRITICAL_SECTION hb_mutex_impl_t; |
49 #define HB_MUTEX_IMPL_INIT {0} | 49 #define HB_MUTEX_IMPL_INIT {0} |
| 50 #if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAM
ILY==WINAPI_FAMILY_PHONE_APP) |
| 51 #define hb_mutex_impl_init(M) InitializeCriticalSectionEx (M, 0, 0) |
| 52 #else |
50 #define hb_mutex_impl_init(M) InitializeCriticalSection (M) | 53 #define hb_mutex_impl_init(M) InitializeCriticalSection (M) |
| 54 #endif |
51 #define hb_mutex_impl_lock(M) EnterCriticalSection (M) | 55 #define hb_mutex_impl_lock(M) EnterCriticalSection (M) |
52 #define hb_mutex_impl_unlock(M) LeaveCriticalSection (M) | 56 #define hb_mutex_impl_unlock(M) LeaveCriticalSection (M) |
53 #define hb_mutex_impl_finish(M) DeleteCriticalSection (M) | 57 #define hb_mutex_impl_finish(M) DeleteCriticalSection (M) |
54 | 58 |
55 | 59 |
56 #elif !defined(HB_NO_MT) && (defined(HAVE_PTHREAD) || defined(__APPLE__)) | 60 #elif !defined(HB_NO_MT) && (defined(HAVE_PTHREAD) || defined(__APPLE__)) |
57 | 61 |
58 #include <pthread.h> | 62 #include <pthread.h> |
59 typedef pthread_mutex_t hb_mutex_impl_t; | 63 typedef pthread_mutex_t hb_mutex_impl_t; |
60 #define HB_MUTEX_IMPL_INIT PTHREAD_MUTEX_INITIALIZER | 64 #define HB_MUTEX_IMPL_INIT PTHREAD_MUTEX_INITIALIZER |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 hb_mutex_impl_t m; | 124 hb_mutex_impl_t m; |
121 | 125 |
122 inline void init (void) { hb_mutex_impl_init (&m); } | 126 inline void init (void) { hb_mutex_impl_init (&m); } |
123 inline void lock (void) { hb_mutex_impl_lock (&m); } | 127 inline void lock (void) { hb_mutex_impl_lock (&m); } |
124 inline void unlock (void) { hb_mutex_impl_unlock (&m); } | 128 inline void unlock (void) { hb_mutex_impl_unlock (&m); } |
125 inline void finish (void) { hb_mutex_impl_finish (&m); } | 129 inline void finish (void) { hb_mutex_impl_finish (&m); } |
126 }; | 130 }; |
127 | 131 |
128 | 132 |
129 #endif /* HB_MUTEX_PRIVATE_HH */ | 133 #endif /* HB_MUTEX_PRIVATE_HH */ |
OLD | NEW |