2004-11-11 22:07:14 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) Igor Sysoev
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <ngx_config.h>
|
|
|
|
#include <ngx_core.h>
|
|
|
|
|
|
|
|
|
|
|
|
ngx_int_t ngx_threads_n;
|
|
|
|
|
|
|
|
|
|
|
|
static size_t stack_size;
|
|
|
|
|
|
|
|
|
2005-10-19 20:33:58 +08:00
|
|
|
ngx_err_t
|
|
|
|
ngx_create_thread(ngx_tid_t *tid,
|
|
|
|
ngx_thread_value_t (__stdcall *func)(void *arg), void *arg, ngx_log_t *log)
|
2004-11-11 22:07:14 +08:00
|
|
|
{
|
|
|
|
ngx_err_t err;
|
|
|
|
|
2005-10-19 20:33:58 +08:00
|
|
|
*tid = CreateThread(NULL, stack_size, func, arg, 0, NULL);
|
2004-11-11 22:07:14 +08:00
|
|
|
|
|
|
|
if (*tid != NULL) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = ngx_errno;
|
|
|
|
ngx_log_error(NGX_LOG_ALERT, log, err, "CreateThread() failed");
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-19 20:33:58 +08:00
|
|
|
ngx_int_t
|
|
|
|
ngx_init_threads(int n, size_t size, ngx_cycle_t *cycle)
|
2004-11-11 22:07:14 +08:00
|
|
|
{
|
|
|
|
stack_size = size;
|
|
|
|
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-19 20:33:58 +08:00
|
|
|
ngx_err_t
|
|
|
|
ngx_thread_key_create(ngx_tls_key_t *key)
|
2004-11-11 22:07:14 +08:00
|
|
|
{
|
|
|
|
*key = TlsAlloc();
|
|
|
|
|
|
|
|
if (*key == TLS_OUT_OF_INDEXES) {
|
|
|
|
return ngx_errno;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-19 20:33:58 +08:00
|
|
|
ngx_err_t
|
|
|
|
ngx_thread_set_tls(ngx_tls_key_t *key, void *data)
|
2004-11-11 22:07:14 +08:00
|
|
|
{
|
|
|
|
if (TlsSetValue(*key, data) == 0) {
|
|
|
|
return ngx_errno;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-19 20:33:58 +08:00
|
|
|
ngx_mutex_t *
|
|
|
|
ngx_mutex_init(ngx_log_t *log, ngx_uint_t flags)
|
2004-11-11 22:07:14 +08:00
|
|
|
{
|
|
|
|
return (ngx_mutex_t *) 1;
|
|
|
|
}
|
2005-03-19 20:38:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* STUB */
|
|
|
|
|
2005-10-19 20:33:58 +08:00
|
|
|
void
|
2005-03-19 20:38:37 +08:00
|
|
|
ngx_mutex_lock(ngx_mutex_t *m) {
|
2005-10-19 20:33:58 +08:00
|
|
|
return;
|
2005-03-19 20:38:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-19 20:33:58 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
ngx_int_t
|
|
|
|
ngx_mutex_trylock(ngx_mutex_t *m) {
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
2005-10-19 20:33:58 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
ngx_mutex_unlock(ngx_mutex_t *m) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
/**/
|