diff src/event/modules/ngx_kqueue_module.c @ 6029:e284f3ff6831

Removed old pthread implementation.
author Ruslan Ermilov <ru@nginx.com>
date Fri, 20 Mar 2015 06:43:19 +0300
parents e5f1d83360ef
children 4652f8f26b12
line wrap: on
line diff
--- a/src/event/modules/ngx_kqueue_module.c
+++ b/src/event/modules/ngx_kqueue_module.c
@@ -59,12 +59,6 @@ static ngx_event_t     notify_event;
 static struct kevent   notify_kev;
 #endif
 
-#if (NGX_OLD_THREADS)
-static ngx_mutex_t    *list_mutex;
-static ngx_mutex_t    *kevent_mutex;
-#endif
-
-
 
 static ngx_str_t      kqueue_name = ngx_string("kqueue");
 
@@ -154,20 +148,6 @@ ngx_kqueue_init(ngx_cycle_t *cycle, ngx_
             return NGX_ERROR;
         }
 #endif
-
-#if (NGX_OLD_THREADS)
-
-        list_mutex = ngx_mutex_init(cycle->log, 0);
-        if (list_mutex == NULL) {
-            return NGX_ERROR;
-        }
-
-        kevent_mutex = ngx_mutex_init(cycle->log, 0);
-        if (kevent_mutex == NULL) {
-            return NGX_ERROR;
-        }
-
-#endif
     }
 
     if (max_changes < kcf->changes) {
@@ -310,11 +290,6 @@ ngx_kqueue_done(ngx_cycle_t *cycle)
 
     ngx_kqueue = -1;
 
-#if (NGX_OLD_THREADS)
-    ngx_mutex_destroy(kevent_mutex);
-    ngx_mutex_destroy(list_mutex);
-#endif
-
     ngx_free(change_list1);
     ngx_free(change_list0);
     ngx_free(event_list);
@@ -342,8 +317,6 @@ ngx_kqueue_add_event(ngx_event_t *ev, ng
     ev->disabled = 0;
     ev->oneshot = (flags & NGX_ONESHOT_EVENT) ? 1 : 0;
 
-    ngx_mutex_lock(list_mutex);
-
 #if 0
 
     if (ev->index < nchanges
@@ -368,8 +341,6 @@ ngx_kqueue_add_event(ngx_event_t *ev, ng
                 e->index = ev->index;
             }
 
-            ngx_mutex_unlock(list_mutex);
-
             return NGX_OK;
         }
 
@@ -378,8 +349,6 @@ ngx_kqueue_add_event(ngx_event_t *ev, ng
         ngx_log_error(NGX_LOG_ALERT, ev->log, 0,
                       "previous event on #%d were not passed in kernel", c->fd);
 
-        ngx_mutex_unlock(list_mutex);
-
         return NGX_ERROR;
     }
 
@@ -387,8 +356,6 @@ ngx_kqueue_add_event(ngx_event_t *ev, ng
 
     rc = ngx_kqueue_set_event(ev, event, EV_ADD|EV_ENABLE|flags);
 
-    ngx_mutex_unlock(list_mutex);
-
     return rc;
 }
 
@@ -402,8 +369,6 @@ ngx_kqueue_del_event(ngx_event_t *ev, ng
     ev->active = 0;
     ev->disabled = 0;
 
-    ngx_mutex_lock(list_mutex);
-
     if (ev->index < nchanges
         && ((uintptr_t) change_list[ev->index].udata & (uintptr_t) ~1)
             == (uintptr_t) ev)
@@ -423,8 +388,6 @@ ngx_kqueue_del_event(ngx_event_t *ev, ng
             e->index = ev->index;
         }
 
-        ngx_mutex_unlock(list_mutex);
-
         return NGX_OK;
     }
 
@@ -435,7 +398,6 @@ ngx_kqueue_del_event(ngx_event_t *ev, ng
      */
 
     if (flags & NGX_CLOSE_EVENT) {
-        ngx_mutex_unlock(list_mutex);
         return NGX_OK;
     }
 
@@ -448,8 +410,6 @@ ngx_kqueue_del_event(ngx_event_t *ev, ng
 
     rc = ngx_kqueue_set_event(ev, event, flags);
 
-    ngx_mutex_unlock(list_mutex);
-
     return rc;
 }
 
@@ -756,13 +716,7 @@ ngx_kqueue_process_changes(ngx_cycle_t *
     struct timespec   ts;
     struct kevent    *changes;
 
-    ngx_mutex_lock(kevent_mutex);
-
-    ngx_mutex_lock(list_mutex);
-
     if (nchanges == 0) {
-        ngx_mutex_unlock(list_mutex);
-        ngx_mutex_unlock(kevent_mutex);
         return NGX_OK;
     }
 
@@ -776,8 +730,6 @@ ngx_kqueue_process_changes(ngx_cycle_t *
     n = (int) nchanges;
     nchanges = 0;
 
-    ngx_mutex_unlock(list_mutex);
-
     ts.tv_sec = 0;
     ts.tv_nsec = 0;
 
@@ -794,8 +746,6 @@ ngx_kqueue_process_changes(ngx_cycle_t *
         rc = NGX_OK;
     }
 
-    ngx_mutex_unlock(kevent_mutex);
-
     return rc;
 }