aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/freebsd/ngx_rfork_thread.h
blob: bd500e1a4b13dc0a0944ad1e5c389b99daa96f73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#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_ */