Mercurial > hg > nginx
diff src/event/ngx_event_timer.c @ 5894:1f513d7f1b45
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.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Mon, 25 Aug 2014 13:34:39 +0400 |
parents | 3377f9459e99 |
children | 0f53e5fb7205 |
line wrap: on
line diff
--- a/src/event/ngx_event_timer.c Wed Oct 22 15:31:19 2014 +0200 +++ b/src/event/ngx_event_timer.c Mon Aug 25 13:34:39 2014 +0400 @@ -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_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 @@ 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 @@ 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_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 @@ break; } - - ngx_mutex_unlock(ngx_event_timer_mutex); }