view src/core/ngx_shmtx.h @ 680:597573166f34 NGINX_1_3_3

nginx 1.3.3 *) Feature: entity tags support and the "etag" directive. *) Bugfix: trailing dot in a source value was not ignored if the "map" directive was used with the "hostnames" parameter. *) Bugfix: incorrect location might be used to process a request if a URI was changed via a "rewrite" directive before an internal redirect to a named location.
author Igor Sysoev <>
date Tue, 10 Jul 2012 00:00:00 +0400
parents d0f7a625f27c
line wrap: on
line source

 * Copyright (C) Igor Sysoev
 * Copyright (C) Nginx, Inc.


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

typedef struct {
    ngx_atomic_t   lock;
    ngx_atomic_t   wait;
} ngx_shmtx_sh_t;

typedef struct {
    ngx_atomic_t  *lock;
    ngx_atomic_t  *wait;
    ngx_uint_t     semaphore;
    sem_t          sem;
    ngx_fd_t       fd;
    u_char        *name;
    ngx_uint_t     spin;
} ngx_shmtx_t;

ngx_int_t ngx_shmtx_create(ngx_shmtx_t *mtx, ngx_shmtx_sh_t *addr,
    u_char *name);
void ngx_shmtx_destroy(ngx_shmtx_t *mtx);
ngx_uint_t ngx_shmtx_trylock(ngx_shmtx_t *mtx);
void ngx_shmtx_lock(ngx_shmtx_t *mtx);
void ngx_shmtx_unlock(ngx_shmtx_t *mtx);
ngx_uint_t ngx_shmtx_force_unlock(ngx_shmtx_t *mtx, ngx_pid_t pid);

#endif /* _NGX_SHMTX_H_INCLUDED_ */