comparison src/os/unix/ngx_pthread_thread.c @ 379:73688d5d7fc3

nginx-0.0.7-2004-07-06-20:12:16 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 06 Jul 2004 16:12:16 +0000
parents d0451e402e27
children b670db10cbbd
comparison
equal deleted inserted replaced
378:b7d3625c9336 379:73688d5d7fc3
114 114
115 if (!ngx_threaded) { 115 if (!ngx_threaded) {
116 return NGX_OK; 116 return NGX_OK;
117 } 117 }
118 118
119 ngx_log_debug1(NGX_LOG_DEBUG_CORE, m->log, 0, "lock mutex " PTR_FMT, m); 119 ngx_log_debug1(NGX_LOG_DEBUG_MUTEX, m->log, 0, "lock mutex " PTR_FMT, m);
120 120
121 err = pthread_mutex_lock(&m->mutex); 121 err = pthread_mutex_lock(&m->mutex);
122 122
123 if (err != 0) { 123 if (err != 0) {
124 ngx_log_error(NGX_LOG_ALERT, m->log, err, 124 ngx_log_error(NGX_LOG_ALERT, m->log, err,
125 "pthread_mutex_lock(" PTR_FMT ") failed", m); 125 "pthread_mutex_lock(" PTR_FMT ") failed", m);
126 return NGX_ERROR; 126 return NGX_ERROR;
127 } 127 }
128 128
129 ngx_log_debug1(NGX_LOG_DEBUG_CORE, m->log, 0, 129 ngx_log_debug1(NGX_LOG_DEBUG_MUTEX, m->log, 0,
130 "mutex " PTR_FMT " is locked", m); 130 "mutex " PTR_FMT " is locked", m);
131 131
132 return NGX_OK; 132 return NGX_OK;
133 } 133 }
134 134
139 139
140 if (!ngx_threaded) { 140 if (!ngx_threaded) {
141 return NGX_OK; 141 return NGX_OK;
142 } 142 }
143 143
144 ngx_log_debug1(NGX_LOG_DEBUG_CORE, m->log, 0, "try lock mutex " PTR_FMT, m); 144 ngx_log_debug1(NGX_LOG_DEBUG_MUTEX, m->log, 0,
145 "try lock mutex " PTR_FMT, m);
145 146
146 err = pthread_mutex_trylock(&m->mutex); 147 err = pthread_mutex_trylock(&m->mutex);
147 148
148 if (err != 0) { 149 if (err != 0) {
149 ngx_log_error(NGX_LOG_ALERT, m->log, err, 150 ngx_log_error(NGX_LOG_ALERT, m->log, err,
150 "pthread_mutex_trylock(" PTR_FMT ") failed", m); 151 "pthread_mutex_trylock(" PTR_FMT ") failed", m);
151 return NGX_ERROR; 152 return NGX_ERROR;
152 } 153 }
153 154
154 ngx_log_debug1(NGX_LOG_DEBUG_CORE, m->log, 0, 155 ngx_log_debug1(NGX_LOG_DEBUG_MUTEX, m->log, 0,
155 "mutex " PTR_FMT " is locked", m); 156 "mutex " PTR_FMT " is locked", m);
156 157
157 return NGX_OK; 158 return NGX_OK;
158 } 159 }
159 160
164 165
165 if (!ngx_threaded) { 166 if (!ngx_threaded) {
166 return NGX_OK; 167 return NGX_OK;
167 } 168 }
168 169
169 ngx_log_debug1(NGX_LOG_DEBUG_CORE, m->log, 0, "unlock mutex " PTR_FMT, m); 170 ngx_log_debug1(NGX_LOG_DEBUG_MUTEX, m->log, 0, "unlock mutex " PTR_FMT, m);
170 171
171 err = pthread_mutex_unlock(&m->mutex); 172 err = pthread_mutex_unlock(&m->mutex);
172 173
173 if (err != 0) { 174 if (err != 0) {
174 ngx_log_error(NGX_LOG_ALERT, m->log, err, 175 ngx_log_error(NGX_LOG_ALERT, m->log, err,
175 "pthread_mutex_unlock(" PTR_FMT ") failed", m); 176 "pthread_mutex_unlock(" PTR_FMT ") failed", m);
176 return NGX_ERROR; 177 return NGX_ERROR;
177 } 178 }
178 179
179 ngx_log_debug1(NGX_LOG_DEBUG_CORE, m->log, 0, 180 ngx_log_debug1(NGX_LOG_DEBUG_MUTEX, m->log, 0,
180 "mutex " PTR_FMT " is unlocked", m); 181 "mutex " PTR_FMT " is unlocked", m);
181 182
182 return NGX_OK; 183 return NGX_OK;
183 } 184 }
184 185
237 } 238 }
238 239
239 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cv->log, 0, 240 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cv->log, 0,
240 "cv " PTR_FMT " is waked up", cv); 241 "cv " PTR_FMT " is waked up", cv);
241 242
242 ngx_log_debug1(NGX_LOG_DEBUG_CORE, m->log, 0, 243 ngx_log_debug1(NGX_LOG_DEBUG_MUTEX, m->log, 0,
243 "mutex " PTR_FMT " is locked", m); 244 "mutex " PTR_FMT " is locked", m);
244 245
245 return NGX_OK; 246 return NGX_OK;
246 } 247 }
247 248