2004-09-28 03:34:51 -05:00
|
|
|
|
|
|
|
/*
|
2004-09-29 11:00:49 -05:00
|
|
|
* Copyright (C) Igor Sysoev
|
2004-09-28 03:34:51 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2004-04-04 15:32:09 -05:00
|
|
|
#ifndef _NGX_EVENT_POSTED_H_INCLUDED_
|
|
|
|
#define _NGX_EVENT_POSTED_H_INCLUDED_
|
|
|
|
|
|
|
|
|
|
|
|
#include <ngx_config.h>
|
|
|
|
#include <ngx_core.h>
|
|
|
|
#include <ngx_event.h>
|
|
|
|
|
|
|
|
|
|
|
|
#define ngx_post_event(ev) \
|
2004-07-02 10:54:34 -05:00
|
|
|
if (ev->prev == NULL) { \
|
2004-04-04 15:32:09 -05:00
|
|
|
ev->next = (ngx_event_t *) ngx_posted_events; \
|
2004-07-02 10:54:34 -05:00
|
|
|
ev->prev = (ngx_event_t **) &ngx_posted_events; \
|
2004-04-04 15:32:09 -05:00
|
|
|
ngx_posted_events = ev; \
|
2004-07-05 10:08:23 -05:00
|
|
|
if (ev->next) { \
|
|
|
|
ev->next->prev = &ev->next; \
|
|
|
|
} \
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_CORE, ev->log, 0, \
|
2004-11-11 08:07:14 -06:00
|
|
|
"post event %p", ev); \
|
2004-07-05 10:08:23 -05:00
|
|
|
} else { \
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_CORE, ev->log, 0, \
|
2004-11-11 08:07:14 -06:00
|
|
|
"update posted event %p", ev); \
|
2004-07-02 10:54:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#define ngx_delete_posted_event(ev) \
|
|
|
|
*(ev->prev) = ev->next; \
|
|
|
|
if (ev->next) { \
|
|
|
|
ev->next->prev = ev->prev; \
|
|
|
|
} \
|
2004-07-05 10:08:23 -05:00
|
|
|
ev->prev = NULL; \
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_CORE, ev->log, 0, \
|
2004-11-11 08:07:14 -06:00
|
|
|
"delete posted event %p", ev);
|
2004-07-02 10:54:34 -05:00
|
|
|
|
2004-06-30 10:30:41 -05:00
|
|
|
|
2004-04-04 15:32:09 -05:00
|
|
|
|
|
|
|
void ngx_event_process_posted(ngx_cycle_t *cycle);
|
2004-07-05 01:55:54 -05:00
|
|
|
void ngx_wakeup_worker_thread(ngx_cycle_t *cycle);
|
2004-04-04 15:32:09 -05:00
|
|
|
|
|
|
|
extern ngx_thread_volatile ngx_event_t *ngx_posted_events;
|
2004-06-27 13:01:57 -05:00
|
|
|
|
|
|
|
|
2004-04-04 15:32:09 -05:00
|
|
|
#if (NGX_THREADS)
|
2004-06-27 13:01:57 -05:00
|
|
|
ngx_int_t ngx_event_thread_process_posted(ngx_cycle_t *cycle);
|
|
|
|
|
2004-04-04 15:32:09 -05:00
|
|
|
extern ngx_mutex_t *ngx_posted_events_mutex;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* _NGX_EVENT_POSTED_H_INCLUDED_ */
|