461
|
1
|
|
2 /*
|
|
3 * Copyright (C) Igor Sysoev
|
4412
|
4 * Copyright (C) Nginx, Inc.
|
461
|
5 */
|
|
6
|
|
7
|
|
8 #include <ngx_config.h>
|
|
9 #include <ngx_core.h>
|
|
10
|
|
11
|
|
12 ngx_int_t ngx_threads_n;
|
|
13
|
|
14
|
|
15 static size_t stack_size;
|
|
16
|
|
17
|
563
|
18 ngx_err_t
|
|
19 ngx_create_thread(ngx_tid_t *tid,
|
|
20 ngx_thread_value_t (__stdcall *func)(void *arg), void *arg, ngx_log_t *log)
|
461
|
21 {
|
2725
|
22 u_long id;
|
461
|
23 ngx_err_t err;
|
|
24
|
2725
|
25 *tid = CreateThread(NULL, stack_size, func, arg, 0, &id);
|
461
|
26
|
|
27 if (*tid != NULL) {
|
2725
|
28 ngx_log_error(NGX_LOG_NOTICE, log, 0,
|
|
29 "create thread " NGX_TID_T_FMT, id);
|
461
|
30 return 0;
|
|
31 }
|
|
32
|
|
33 err = ngx_errno;
|
|
34 ngx_log_error(NGX_LOG_ALERT, log, err, "CreateThread() failed");
|
|
35 return err;
|
|
36 }
|
|
37
|
|
38
|
563
|
39 ngx_int_t
|
|
40 ngx_init_threads(int n, size_t size, ngx_cycle_t *cycle)
|
461
|
41 {
|
|
42 stack_size = size;
|
|
43
|
|
44 return NGX_OK;
|
|
45 }
|