src/os/win32/ngx_thread.c - nginx source code

Functions defined

Source code


  1. /*
  2. * Copyright (C) Igor Sysoev
  3. * Copyright (C) Nginx, Inc.
  4. */


  5. #include <ngx_config.h>
  6. #include <ngx_core.h>


  7. ngx_err_t
  8. ngx_create_thread(ngx_tid_t *tid,
  9.     ngx_thread_value_t (__stdcall *func)(void *arg), void *arg, ngx_log_t *log)
  10. {
  11.     u_long     id;
  12.     ngx_err_t  err;

  13.     *tid = CreateThread(NULL, 0, func, arg, 0, &id);

  14.     if (*tid != NULL) {
  15.         ngx_log_error(NGX_LOG_NOTICE, log, 0,
  16.                       "create thread " NGX_TID_T_FMT, id);
  17.         return 0;
  18.     }

  19.     err = ngx_errno;
  20.     ngx_log_error(NGX_LOG_ALERT, log, err, "CreateThread() failed");
  21.     return err;
  22. }