OLD | NEW |
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* ***** BEGIN LICENSE BLOCK ***** | 2 /* ***** BEGIN LICENSE BLOCK ***** |
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
4 * | 4 * |
5 * The contents of this file are subject to the Mozilla Public License Version | 5 * The contents of this file are subject to the Mozilla Public License Version |
6 * 1.1 (the "License"); you may not use this file except in compliance with | 6 * 1.1 (the "License"); you may not use this file except in compliance with |
7 * the License. You may obtain a copy of the License at | 7 * the License. You may obtain a copy of the License at |
8 * http://www.mozilla.org/MPL/ | 8 * http://www.mozilla.org/MPL/ |
9 * | 9 * |
10 * Software distributed under the License is distributed on an "AS IS" basis, | 10 * Software distributed under the License is distributed on an "AS IS" basis, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 pthread_cond_init(&(m), NULL)) | 91 pthread_cond_init(&(m), NULL)) |
92 #else | 92 #else |
93 #define _PT_PTHREAD_MUTEXATTR_INIT pthread_mutexattr_init | 93 #define _PT_PTHREAD_MUTEXATTR_INIT pthread_mutexattr_init |
94 #define _PT_PTHREAD_MUTEXATTR_DESTROY pthread_mutexattr_destroy | 94 #define _PT_PTHREAD_MUTEXATTR_DESTROY pthread_mutexattr_destroy |
95 #define _PT_PTHREAD_MUTEX_INIT(m, a) pthread_mutex_init(&(m), &(a)) | 95 #define _PT_PTHREAD_MUTEX_INIT(m, a) pthread_mutex_init(&(m), &(a)) |
96 #if defined(FREEBSD) | 96 #if defined(FREEBSD) |
97 #define _PT_PTHREAD_MUTEX_IS_LOCKED(m) pt_pthread_mutex_is_locked(&(m)) | 97 #define _PT_PTHREAD_MUTEX_IS_LOCKED(m) pt_pthread_mutex_is_locked(&(m)) |
98 #else | 98 #else |
99 #define _PT_PTHREAD_MUTEX_IS_LOCKED(m) (EBUSY == pthread_mutex_trylock(&(m))) | 99 #define _PT_PTHREAD_MUTEX_IS_LOCKED(m) (EBUSY == pthread_mutex_trylock(&(m))) |
100 #endif | 100 #endif |
| 101 #if defined(ANDROID) |
| 102 /* Conditional attribute init and destroy aren't implemented in bionic. */ |
| 103 #define _PT_PTHREAD_CONDATTR_INIT(x) 0 |
| 104 #define _PT_PTHREAD_CONDATTR_DESTROY(x) /* */ |
| 105 #else |
101 #define _PT_PTHREAD_CONDATTR_INIT pthread_condattr_init | 106 #define _PT_PTHREAD_CONDATTR_INIT pthread_condattr_init |
102 #define _PT_PTHREAD_CONDATTR_DESTROY pthread_condattr_destroy | 107 #define _PT_PTHREAD_CONDATTR_DESTROY pthread_condattr_destroy |
| 108 #endif |
103 #define _PT_PTHREAD_COND_INIT(m, a) pthread_cond_init(&(m), &(a)) | 109 #define _PT_PTHREAD_COND_INIT(m, a) pthread_cond_init(&(m), &(a)) |
104 #endif | 110 #endif |
105 | 111 |
106 /* The pthreads standard does not specify an invalid value for the | 112 /* The pthreads standard does not specify an invalid value for the |
107 * pthread_t handle. (0 is usually an invalid pthread identifier | 113 * pthread_t handle. (0 is usually an invalid pthread identifier |
108 * but there are exceptions, for example, DG/UX.) These macros | 114 * but there are exceptions, for example, DG/UX.) These macros |
109 * define a way to set the handle to or compare the handle with an | 115 * define a way to set the handle to or compare the handle with an |
110 * invalid identifier. These macros are not portable and may be | 116 * invalid identifier. These macros are not portable and may be |
111 * more of a problem as we adapt to more pthreads implementations. | 117 * more of a problem as we adapt to more pthreads implementations. |
112 * They are only used in the PRMonitor functions. Do not use them | 118 * They are only used in the PRMonitor functions. Do not use them |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \ | 297 || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \ |
292 || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \ | 298 || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \ |
293 || defined(BSDI) || defined(NTO) || defined(DARWIN) \ | 299 || defined(BSDI) || defined(NTO) || defined(DARWIN) \ |
294 || defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN) | 300 || defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN) |
295 #define _PT_PTHREAD_YIELD() sched_yield() | 301 #define _PT_PTHREAD_YIELD() sched_yield() |
296 #else | 302 #else |
297 #error "Need to define _PT_PTHREAD_YIELD for this platform" | 303 #error "Need to define _PT_PTHREAD_YIELD for this platform" |
298 #endif | 304 #endif |
299 | 305 |
300 #endif /* nspr_pth_defs_h_ */ | 306 #endif /* nspr_pth_defs_h_ */ |
OLD | NEW |