return NULL;
}
- /* ngx_mutex_lock */
-
c = ngx_cycle->free_connections;
if (c == NULL) {
"%ui worker_connections are not enough",
ngx_cycle->connection_n);
- /* ngx_mutex_unlock */
-
return NULL;
}
ngx_cycle->free_connections = c->data;
ngx_cycle->free_connection_n--;
- /* ngx_mutex_unlock */
-
if (ngx_cycle->files) {
ngx_cycle->files[s] = c;
}
void
ngx_free_connection(ngx_connection_t *c)
{
- /* ngx_mutex_lock */
-
c->data = ngx_cycle->free_connections;
ngx_cycle->free_connections = c;
ngx_cycle->free_connection_n++;
- /* ngx_mutex_unlock */
-
if (ngx_cycle->files) {
ngx_cycle->files[c->fd] = NULL;
}
return 0;
}
-
-
-ngx_mutex_t *
-ngx_mutex_init(ngx_log_t *log, ngx_uint_t flags)
-{
- ngx_mutex_t *m;
-
- m = ngx_alloc(sizeof(ngx_mutex_t), log);
- if (m == NULL) {
- return NULL;
- }
-
- m->log = log;
-
- /* STUB */
-
- return m;
-}
-
-
-/* STUB */
-
-void
-ngx_mutex_lock(ngx_mutex_t *m) {
- return;
-}
-
-
-
-ngx_int_t
-ngx_mutex_trylock(ngx_mutex_t *m) {
- return NGX_OK;
-}
-
-
-void
-ngx_mutex_unlock(ngx_mutex_t *m) {
- return;
-}
-
-/**/
typedef DWORD ngx_thread_value_t;
-typedef struct {
- HANDLE mutex;
- ngx_log_t *log;
-} ngx_mutex_t;
-
-
ngx_err_t ngx_create_thread(ngx_tid_t *tid,
ngx_thread_value_t (__stdcall *func)(void *arg), void *arg, ngx_log_t *log);
ngx_int_t ngx_init_threads(int n, size_t size, ngx_cycle_t *cycle);
#define ngx_thread_set_tls_n "TlsSetValue()"
#define ngx_thread_get_tls TlsGetValue
-
-#define ngx_thread_volatile volatile
-
#define ngx_log_tid GetCurrentThreadId()
#define NGX_TID_T_FMT "%ud"
-ngx_mutex_t *ngx_mutex_init(ngx_log_t *log, ngx_uint_t flags);
-
-void ngx_mutex_lock(ngx_mutex_t *m);
-ngx_int_t ngx_mutex_trylock(ngx_mutex_t *m);
-void ngx_mutex_unlock(ngx_mutex_t *m);
-
-
-/* STUB */
-#define NGX_MUTEX_LIGHT 0
-/**/
-
-
extern ngx_int_t ngx_threads_n;