mirror of
https://github.com/nginx/nginx.git
synced 2024-12-20 06:03:31 -06:00
Events: removed broken thread support from event timers.
It's mostly dead code. And the idea of thread support for this task has been deprecated.
This commit is contained in:
parent
2d16e3c3a1
commit
246152c864
@ -22,8 +22,7 @@ static ngx_inline void ngx_rbtree_right_rotate(ngx_rbtree_node_t **root,
|
||||
|
||||
|
||||
void
|
||||
ngx_rbtree_insert(ngx_thread_volatile ngx_rbtree_t *tree,
|
||||
ngx_rbtree_node_t *node)
|
||||
ngx_rbtree_insert(ngx_rbtree_t *tree, ngx_rbtree_node_t *node)
|
||||
{
|
||||
ngx_rbtree_node_t **root, *temp, *sentinel;
|
||||
|
||||
@ -155,8 +154,7 @@ ngx_rbtree_insert_timer_value(ngx_rbtree_node_t *temp, ngx_rbtree_node_t *node,
|
||||
|
||||
|
||||
void
|
||||
ngx_rbtree_delete(ngx_thread_volatile ngx_rbtree_t *tree,
|
||||
ngx_rbtree_node_t *node)
|
||||
ngx_rbtree_delete(ngx_rbtree_t *tree, ngx_rbtree_node_t *node)
|
||||
{
|
||||
ngx_uint_t red;
|
||||
ngx_rbtree_node_t **root, *sentinel, *subst, *temp, *w;
|
||||
|
@ -48,10 +48,8 @@ struct ngx_rbtree_s {
|
||||
(tree)->insert = i
|
||||
|
||||
|
||||
void ngx_rbtree_insert(ngx_thread_volatile ngx_rbtree_t *tree,
|
||||
ngx_rbtree_node_t *node);
|
||||
void ngx_rbtree_delete(ngx_thread_volatile ngx_rbtree_t *tree,
|
||||
ngx_rbtree_node_t *node);
|
||||
void ngx_rbtree_insert(ngx_rbtree_t *tree, ngx_rbtree_node_t *node);
|
||||
void ngx_rbtree_delete(ngx_rbtree_t *tree, ngx_rbtree_node_t *node);
|
||||
void ngx_rbtree_insert_value(ngx_rbtree_node_t *root, ngx_rbtree_node_t *node,
|
||||
ngx_rbtree_node_t *sentinel);
|
||||
void ngx_rbtree_insert_timer_value(ngx_rbtree_node_t *root,
|
||||
|
@ -10,13 +10,8 @@
|
||||
#include <ngx_event.h>
|
||||
|
||||
|
||||
#if (NGX_THREADS)
|
||||
ngx_mutex_t *ngx_event_timer_mutex;
|
||||
#endif
|
||||
|
||||
|
||||
ngx_thread_volatile ngx_rbtree_t ngx_event_timer_rbtree;
|
||||
static ngx_rbtree_node_t ngx_event_timer_sentinel;
|
||||
ngx_rbtree_t ngx_event_timer_rbtree;
|
||||
static ngx_rbtree_node_t ngx_event_timer_sentinel;
|
||||
|
||||
/*
|
||||
* the event timer rbtree may contain the duplicate keys, however,
|
||||
@ -30,20 +25,6 @@ ngx_event_timer_init(ngx_log_t *log)
|
||||
ngx_rbtree_init(&ngx_event_timer_rbtree, &ngx_event_timer_sentinel,
|
||||
ngx_rbtree_insert_timer_value);
|
||||
|
||||
#if (NGX_THREADS)
|
||||
|
||||
if (ngx_event_timer_mutex) {
|
||||
ngx_event_timer_mutex->log = log;
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
ngx_event_timer_mutex = ngx_mutex_init(log, 0);
|
||||
if (ngx_event_timer_mutex == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
@ -58,15 +39,11 @@ ngx_event_find_timer(void)
|
||||
return NGX_TIMER_INFINITE;
|
||||
}
|
||||
|
||||
ngx_mutex_lock(ngx_event_timer_mutex);
|
||||
|
||||
root = ngx_event_timer_rbtree.root;
|
||||
sentinel = ngx_event_timer_rbtree.sentinel;
|
||||
|
||||
node = ngx_rbtree_min(root, sentinel);
|
||||
|
||||
ngx_mutex_unlock(ngx_event_timer_mutex);
|
||||
|
||||
timer = (ngx_msec_int_t) (node->key - ngx_current_msec);
|
||||
|
||||
return (ngx_msec_t) (timer > 0 ? timer : 0);
|
||||
@ -82,9 +59,6 @@ ngx_event_expire_timers(void)
|
||||
sentinel = ngx_event_timer_rbtree.sentinel;
|
||||
|
||||
for ( ;; ) {
|
||||
|
||||
ngx_mutex_lock(ngx_event_timer_mutex);
|
||||
|
||||
root = ngx_event_timer_rbtree.root;
|
||||
|
||||
if (root == sentinel) {
|
||||
@ -104,8 +78,6 @@ ngx_event_expire_timers(void)
|
||||
|
||||
ngx_rbtree_delete(&ngx_event_timer_rbtree, &ev->timer);
|
||||
|
||||
ngx_mutex_unlock(ngx_event_timer_mutex);
|
||||
|
||||
#if (NGX_DEBUG)
|
||||
ev->timer.left = NULL;
|
||||
ev->timer.right = NULL;
|
||||
@ -123,6 +95,4 @@ ngx_event_expire_timers(void)
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
ngx_mutex_unlock(ngx_event_timer_mutex);
|
||||
}
|
||||
|
@ -24,12 +24,7 @@ ngx_msec_t ngx_event_find_timer(void);
|
||||
void ngx_event_expire_timers(void);
|
||||
|
||||
|
||||
#if (NGX_THREADS)
|
||||
extern ngx_mutex_t *ngx_event_timer_mutex;
|
||||
#endif
|
||||
|
||||
|
||||
extern ngx_thread_volatile ngx_rbtree_t ngx_event_timer_rbtree;
|
||||
extern ngx_rbtree_t ngx_event_timer_rbtree;
|
||||
|
||||
|
||||
static ngx_inline void
|
||||
@ -39,12 +34,8 @@ ngx_event_del_timer(ngx_event_t *ev)
|
||||
"event timer del: %d: %M",
|
||||
ngx_event_ident(ev->data), ev->timer.key);
|
||||
|
||||
ngx_mutex_lock(ngx_event_timer_mutex);
|
||||
|
||||
ngx_rbtree_delete(&ngx_event_timer_rbtree, &ev->timer);
|
||||
|
||||
ngx_mutex_unlock(ngx_event_timer_mutex);
|
||||
|
||||
#if (NGX_DEBUG)
|
||||
ev->timer.left = NULL;
|
||||
ev->timer.right = NULL;
|
||||
@ -89,12 +80,8 @@ ngx_event_add_timer(ngx_event_t *ev, ngx_msec_t timer)
|
||||
"event timer add: %d: %M:%M",
|
||||
ngx_event_ident(ev->data), timer, ev->timer.key);
|
||||
|
||||
ngx_mutex_lock(ngx_event_timer_mutex);
|
||||
|
||||
ngx_rbtree_insert(&ngx_event_timer_rbtree, &ev->timer);
|
||||
|
||||
ngx_mutex_unlock(ngx_event_timer_mutex);
|
||||
|
||||
ev->timer_set = 1;
|
||||
}
|
||||
|
||||
|
@ -1213,7 +1213,6 @@ ngx_wakeup_worker_threads(ngx_cycle_t *cycle)
|
||||
|
||||
/* STUB */
|
||||
ngx_done_events(cycle);
|
||||
ngx_mutex_destroy(ngx_event_timer_mutex);
|
||||
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user