Back to home page

Nginx displayed by LXR

Source navigation ]
Diff markup ]
Identifier search ]
general search ]
 
 
Version: nginx-1.13.12 ]​[ nginx-1.12.2 ]​

0001 
0002 /*
0003  * Copyright (C) Igor Sysoev
0004  * Copyright (C) Nginx, Inc.
0005  */
0006 
0007 
0008 #ifndef _NGX_SHMTX_H_INCLUDED_
0009 #define _NGX_SHMTX_H_INCLUDED_
0010 
0011 
0012 #include <ngx_config.h>
0013 #include <ngx_core.h>
0014 
0015 
0016 typedef struct {
0017     ngx_atomic_t   lock;
0018 #if (NGX_HAVE_POSIX_SEM)
0019     ngx_atomic_t   wait;
0020 #endif
0021 } ngx_shmtx_sh_t;
0022 
0023 
0024 typedef struct {
0025 #if (NGX_HAVE_ATOMIC_OPS)
0026     ngx_atomic_t  *lock;
0027 #if (NGX_HAVE_POSIX_SEM)
0028     ngx_atomic_t  *wait;
0029     ngx_uint_t     semaphore;
0030     sem_t          sem;
0031 #endif
0032 #else
0033     ngx_fd_t       fd;
0034     u_char        *name;
0035 #endif
0036     ngx_uint_t     spin;
0037 } ngx_shmtx_t;
0038 
0039 
0040 ngx_int_t ngx_shmtx_create(ngx_shmtx_t *mtx, ngx_shmtx_sh_t *addr,
0041     u_char *name);
0042 void ngx_shmtx_destroy(ngx_shmtx_t *mtx);
0043 ngx_uint_t ngx_shmtx_trylock(ngx_shmtx_t *mtx);
0044 void ngx_shmtx_lock(ngx_shmtx_t *mtx);
0045 void ngx_shmtx_unlock(ngx_shmtx_t *mtx);
0046 ngx_uint_t ngx_shmtx_force_unlock(ngx_shmtx_t *mtx, ngx_pid_t pid);
0047 
0048 
0049 #endif /* _NGX_SHMTX_H_INCLUDED_ */