nxt_thread_mutex.c (0:a63ceefd6ab0) nxt_thread_mutex.c (564:762f8c976ead)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 71 unchanged lines hidden (view full) ---

80nxt_int_t
81nxt_thread_mutex_create(nxt_thread_mutex_t *mtx)
82{
83 nxt_err_t err;
84 pthread_mutexattr_t attr;
85
86 err = pthread_mutexattr_init(&attr);
87 if (err != 0) {
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 71 unchanged lines hidden (view full) ---

80nxt_int_t
81nxt_thread_mutex_create(nxt_thread_mutex_t *mtx)
82{
83 nxt_err_t err;
84 pthread_mutexattr_t attr;
85
86 err = pthread_mutexattr_init(&attr);
87 if (err != 0) {
88 nxt_thread_log_emerg("pthread_mutexattr_init() failed %E", err);
88 nxt_thread_log_alert("pthread_mutexattr_init() failed %E", err);
89 return NXT_ERROR;
90 }
91
92 err = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
93 if (err != 0) {
89 return NXT_ERROR;
90 }
91
92 err = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
93 if (err != 0) {
94 nxt_thread_log_emerg("pthread_mutexattr_settype"
94 nxt_thread_log_alert("pthread_mutexattr_settype"
95 "(PTHREAD_MUTEX_ERRORCHECK) failed %E", err);
96 return NXT_ERROR;
97 }
98
99 err = pthread_mutex_init(mtx, &attr);
100 if (err != 0) {
95 "(PTHREAD_MUTEX_ERRORCHECK) failed %E", err);
96 return NXT_ERROR;
97 }
98
99 err = pthread_mutex_init(mtx, &attr);
100 if (err != 0) {
101 nxt_thread_log_emerg("pthread_mutex_init() failed %E", err);
101 nxt_thread_log_alert("pthread_mutex_init() failed %E", err);
102 return NXT_ERROR;
103 }
104
105 err = pthread_mutexattr_destroy(&attr);
106 if (err != 0) {
107 nxt_thread_log_alert("pthread_mutexattr_destroy() failed %E", err);
108 }
109

--- 83 unchanged lines hidden ---
102 return NXT_ERROR;
103 }
104
105 err = pthread_mutexattr_destroy(&attr);
106 if (err != 0) {
107 nxt_thread_log_alert("pthread_mutexattr_destroy() failed %E", err);
108 }
109

--- 83 unchanged lines hidden ---