comparison src/os/unix/ngx_user.c @ 6016:457ec43dd8d5

Renamed NGX_THREADS to NGX_OLD_THREADS because of deprecation. It's mostly dead code and the original idea of worker threads has been rejected.
author Ruslan Ermilov <ru@nginx.com>
date Wed, 04 Mar 2015 18:26:25 +0300
parents fd6fd02f6a4d
children e284f3ff6831
comparison
equal deleted inserted replaced
6015:e11a8e7e8e0c 6016:457ec43dd8d5
62 { 62 {
63 char *value; 63 char *value;
64 size_t len; 64 size_t len;
65 ngx_err_t err; 65 ngx_err_t err;
66 66
67 #if (NGX_THREADS && NGX_NONREENTRANT_CRYPT) 67 #if (NGX_OLD_THREADS && NGX_NONREENTRANT_CRYPT)
68 68
69 /* crypt() is a time consuming function, so we only try to lock */ 69 /* crypt() is a time consuming function, so we only try to lock */
70 70
71 if (ngx_mutex_trylock(ngx_crypt_mutex) != NGX_OK) { 71 if (ngx_mutex_trylock(ngx_crypt_mutex) != NGX_OK) {
72 return NGX_AGAIN; 72 return NGX_AGAIN;
79 if (value) { 79 if (value) {
80 len = ngx_strlen(value) + 1; 80 len = ngx_strlen(value) + 1;
81 81
82 *encrypted = ngx_pnalloc(pool, len); 82 *encrypted = ngx_pnalloc(pool, len);
83 if (*encrypted == NULL) { 83 if (*encrypted == NULL) {
84 #if (NGX_THREADS && NGX_NONREENTRANT_CRYPT) 84 #if (NGX_OLD_THREADS && NGX_NONREENTRANT_CRYPT)
85 ngx_mutex_unlock(ngx_crypt_mutex); 85 ngx_mutex_unlock(ngx_crypt_mutex);
86 #endif 86 #endif
87 return NGX_ERROR; 87 return NGX_ERROR;
88 } 88 }
89 89
90 ngx_memcpy(*encrypted, value, len); 90 ngx_memcpy(*encrypted, value, len);
91 #if (NGX_THREADS && NGX_NONREENTRANT_CRYPT) 91 #if (NGX_OLD_THREADS && NGX_NONREENTRANT_CRYPT)
92 ngx_mutex_unlock(ngx_crypt_mutex); 92 ngx_mutex_unlock(ngx_crypt_mutex);
93 #endif 93 #endif
94 return NGX_OK; 94 return NGX_OK;
95 } 95 }
96 96
97 err = ngx_errno; 97 err = ngx_errno;
98 98
99 #if (NGX_THREADS && NGX_NONREENTRANT_CRYPT) 99 #if (NGX_OLD_THREADS && NGX_NONREENTRANT_CRYPT)
100 ngx_mutex_unlock(ngx_crypt_mutex); 100 ngx_mutex_unlock(ngx_crypt_mutex);
101 #endif 101 #endif
102 102
103 ngx_log_error(NGX_LOG_CRIT, pool->log, err, "crypt() failed"); 103 ngx_log_error(NGX_LOG_CRIT, pool->log, err, "crypt() failed");
104 104