view src/os/unix/freebsd/ngx_rfork_thread.h @ 8:708f8bb772ec

nginx-0.0.1-2002-09-02-18:48:24 import
author Igor Sysoev <igor@sysoev.ru>
date Mon, 02 Sep 2002 14:48:24 +0000
parents 34a521b1a148
children a7e45c45a95c
line wrap: on
line source

#ifndef _NGX_OS_THREAD_H_INCLUDED_
#define _NGX_OS_THREAD_H_INCLUDED_


typedef int  ngx_os_tid_t;
typedef int  ngx_tid_t;


extern char   *ngx_stacks_start;
extern char   *ngx_stacks_end;
extern size_t  ngx_stack_size;


static inline ngx_tid_t ngx_gettid()
{   
    char *sp;

    __asm__ ("mov %%esp,%0" : "=r" (sp));
    return (sp > ngx_stacks_end) ? 0:
           (sp - ngx_stacks_start) / ngx_stack_size + 1;
}


#endif /* _NGX_OS_THREAD_H_INCLUDED_ */