| 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 #define WIN32_LEAN_AND_MEAN | 47 #define WIN32_LEAN_AND_MEAN |
| 48 #include <windows.h> | 48 #include <windows.h> |
| 49 | 49 |
| 50 #if defined(__MINGW32__) && !defined(MemoryBarrier) |
| 51 static inline void _HBMemoryBarrier (void) { |
| 52 long dummy = 0; |
| 53 InterlockedExchange (&dummy, 1); |
| 54 } |
| 55 # define MemoryBarrier _HBMemoryBarrier |
| 56 #endif |
| 57 |
| 50 typedef LONG hb_atomic_int_t; | 58 typedef LONG hb_atomic_int_t; |
| 51 #define hb_atomic_int_add(AI, V) InterlockedExchangeAdd (&(AI), (V)) | 59 #define hb_atomic_int_add(AI, V) InterlockedExchangeAdd (&(AI), (V)) |
| 52 | 60 |
| 53 #define hb_atomic_ptr_get(P) (MemoryBarrier (), (void *) *(P)) | 61 #define hb_atomic_ptr_get(P) (MemoryBarrier (), (void *) *(P)) |
| 54 #define hb_atomic_ptr_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((voi
d **) (P), (void *) (N), (void *) (O)) == (void *) (O)) | 62 #define hb_atomic_ptr_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((voi
d **) (P), (void *) (N), (void *) (O)) == (void *) (O)) |
| 55 | 63 |
| 56 | 64 |
| 57 #elif !defined(HB_NO_MT) && defined(__APPLE__) | 65 #elif !defined(HB_NO_MT) && defined(__APPLE__) |
| 58 | 66 |
| 59 #include <libkern/OSAtomic.h> | 67 #include <libkern/OSAtomic.h> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 #define hb_atomic_int_add(AI, V) (((AI) += (V)) - (V)) | 123 #define hb_atomic_int_add(AI, V) (((AI) += (V)) - (V)) |
| 116 | 124 |
| 117 #define hb_atomic_ptr_get(P) ((void *) *(P)) | 125 #define hb_atomic_ptr_get(P) ((void *) *(P)) |
| 118 #define hb_atomic_ptr_cmpexch(P,O,N) (* (void **) (P) == (void *) (O) ? (* (v
oid **) (P) = (void *) (N), true) : false) | 126 #define hb_atomic_ptr_cmpexch(P,O,N) (* (void **) (P) == (void *) (O) ? (* (v
oid **) (P) = (void *) (N), true) : false) |
| 119 | 127 |
| 120 #endif | 128 #endif |
| 121 | 129 |
| 122 /* TODO Add tracing. */ | 130 /* TODO Add tracing. */ |
| 123 | 131 |
| 124 #endif /* HB_ATOMIC_PRIVATE_HH */ | 132 #endif /* HB_ATOMIC_PRIVATE_HH */ |
| OLD | NEW |