src/event/ngx_event_busy_lock.h - nginx-1.7.10

Data types defined

Macros defined

Source code


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


  5. #ifndef _NGX_EVENT_BUSY_LOCK_H_INCLUDED_
  6. #define _NGX_EVENT_BUSY_LOCK_H_INCLUDED_


  7. #include <ngx_config.h>
  8. #include <ngx_core.h>
  9. #include <ngx_event.h>

  10. typedef struct ngx_event_busy_lock_ctx_s  ngx_event_busy_lock_ctx_t;

  11. struct ngx_event_busy_lock_ctx_s {
  12.     ngx_event_t                *event;
  13.     ngx_event_handler_pt        handler;
  14.     void                       *data;
  15.     ngx_msec_t                  timer;

  16.     unsigned                    locked:1;
  17.     unsigned                    waiting:1;
  18.     unsigned                    cache_updated:1;

  19.     char                       *md5;
  20.     ngx_int_t                   slot;

  21.     ngx_event_busy_lock_ctx_t  *next;
  22. };


  23. typedef struct {
  24.     u_char                     *md5_mask;
  25.     char                       *md5;
  26.     ngx_uint_t                  cacheable;

  27.     ngx_uint_t                  busy;
  28.     ngx_uint_t                  max_busy;

  29.     ngx_uint_t                  waiting;
  30.     ngx_uint_t                  max_waiting;

  31.     ngx_event_busy_lock_ctx_t  *events;
  32.     ngx_event_busy_lock_ctx_t  *last;

  33. #if (NGX_THREADS)
  34.     ngx_mutex_t                *mutex;
  35. #endif
  36. } ngx_event_busy_lock_t;


  37. ngx_int_t ngx_event_busy_lock(ngx_event_busy_lock_t *bl,
  38.     ngx_event_busy_lock_ctx_t *ctx);
  39. ngx_int_t ngx_event_busy_lock_cacheable(ngx_event_busy_lock_t *bl,
  40.     ngx_event_busy_lock_ctx_t *ctx);
  41. void ngx_event_busy_unlock(ngx_event_busy_lock_t *bl,
  42.     ngx_event_busy_lock_ctx_t *ctx);
  43. void ngx_event_busy_lock_cancel(ngx_event_busy_lock_t *bl,
  44.     ngx_event_busy_lock_ctx_t *ctx);


  45. #endif /* _NGX_EVENT_BUSY_LOCK_H_INCLUDED_ */