зеркало из https://github.com/mozilla/pjs.git
On BSDI, zero a pthread_mutex_t or pthread_cond_t before initializing
it. This patch is contributed by Bert Driehuis <bert_driehuis@nl.compuware.com>.
This commit is contained in:
Родитель
1e32a6b863
Коммит
43413731d7
|
@ -54,14 +54,22 @@
|
||||||
* Mutex and condition attributes are not supported. The attr
|
* Mutex and condition attributes are not supported. The attr
|
||||||
* argument to pthread_mutex_init() and pthread_cond_init() must
|
* argument to pthread_mutex_init() and pthread_cond_init() must
|
||||||
* be passed as NULL.
|
* be passed as NULL.
|
||||||
|
*
|
||||||
|
* The memset calls in PTHREAD_MUTEX_INIT and PTHREAD_COND_INIT
|
||||||
|
* are to work around BSDI's using a single bit to indicate a mutex
|
||||||
|
* or condition variable is initialized. This entire BSDI section
|
||||||
|
* will go away when BSDI releases updated threads libraries for
|
||||||
|
* BSD/OS 3.1 and 4.0.
|
||||||
*/
|
*/
|
||||||
#define PTHREAD_MUTEXATTR_INIT(x) 0
|
#define PTHREAD_MUTEXATTR_INIT(x) 0
|
||||||
#define PTHREAD_MUTEXATTR_DESTROY(x) /* */
|
#define PTHREAD_MUTEXATTR_DESTROY(x) /* */
|
||||||
#define PTHREAD_MUTEX_INIT(m, a) pthread_mutex_init(&(m), NULL)
|
#define PTHREAD_MUTEX_INIT(m, a) (memset(&(m), 0, sizeof(m)), \
|
||||||
#define PTHREAD_MUTEX_IS_LOCKED(m) (EBUSY == pthread_mutex_trylock(&(m)))
|
pthread_mutex_init(&(m), NULL))
|
||||||
|
#define PTHREAD_MUTEX_IS_LOCKED(m) (EBUSY == pthread_mutex_trylock(&(m)))
|
||||||
#define PTHREAD_CONDATTR_INIT(x) 0
|
#define PTHREAD_CONDATTR_INIT(x) 0
|
||||||
#define PTHREAD_CONDATTR_DESTROY(x) /* */
|
#define PTHREAD_CONDATTR_DESTROY(x) /* */
|
||||||
#define PTHREAD_COND_INIT(m, a) pthread_cond_init(&(m), NULL)
|
#define PTHREAD_COND_INIT(m, a) (memset(&(m), 0, sizeof(m)), \
|
||||||
|
pthread_cond_init(&(m), NULL))
|
||||||
#else
|
#else
|
||||||
#define PTHREAD_MUTEXATTR_INIT pthread_mutexattr_init
|
#define PTHREAD_MUTEXATTR_INIT pthread_mutexattr_init
|
||||||
#define PTHREAD_MUTEXATTR_DESTROY pthread_mutexattr_destroy
|
#define PTHREAD_MUTEXATTR_DESTROY pthread_mutexattr_destroy
|
||||||
|
|
Загрузка…
Ссылка в новой задаче