Return-Path: X-Original-To: apmail-httpd-cvs-archive@www.apache.org Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7AA38186C3 for ; Wed, 30 Sep 2015 15:46:00 +0000 (UTC) Received: (qmail 46765 invoked by uid 500); 30 Sep 2015 15:46:00 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 46704 invoked by uid 500); 30 Sep 2015 15:46:00 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 46695 invoked by uid 99); 30 Sep 2015 15:46:00 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Sep 2015 15:46:00 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id CB7761A3475 for ; Wed, 30 Sep 2015 15:45:59 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.001 X-Spam-Level: * X-Spam-Status: No, score=1.001 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 8_s3eUzFWJkY for ; Wed, 30 Sep 2015 15:45:58 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTP id AC69E20313 for ; Wed, 30 Sep 2015 15:45:57 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id B9AF7E0281 for ; Wed, 30 Sep 2015 15:45:56 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 7F6093A01DC for ; Wed, 30 Sep 2015 15:45:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1706057 - /httpd/httpd/trunk/server/mpm/motorz/motorz.c Date: Wed, 30 Sep 2015 15:45:56 -0000 To: cvs@httpd.apache.org From: jim@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150930154556.7F6093A01DC@svn01-us-west.apache.org> Author: jim Date: Wed Sep 30 15:45:55 2015 New Revision: 1706057 URL: http://svn.apache.org/viewvc?rev=1706057&view=rev Log: Some motorz improvements Modified: httpd/httpd/trunk/server/mpm/motorz/motorz.c Modified: httpd/httpd/trunk/server/mpm/motorz/motorz.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/motorz/motorz.c?rev=1706057&r1=1706056&r2=1706057&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/motorz/motorz.c (original) +++ httpd/httpd/trunk/server/mpm/motorz/motorz.c Wed Sep 30 15:45:55 2015 @@ -66,16 +66,11 @@ static motorz_core_t *motorz_core_get(vo static int timer_comp(void *a, void *b) { - if (a != b) { - apr_time_t t1 = (apr_time_t) (((motorz_timer_t *) a)->expires); - apr_time_t t2 = (apr_time_t) (((motorz_timer_t *) b)->expires); - AP_DEBUG_ASSERT(t1); - AP_DEBUG_ASSERT(t2); - return ((t1 < t2) ? -1 : 1); - } - else { - return 0; - } + apr_time_t t1 = (apr_time_t) (((motorz_timer_t *) a)->expires); + apr_time_t t2 = (apr_time_t) (((motorz_timer_t *) b)->expires); + AP_DEBUG_ASSERT(t1); + AP_DEBUG_ASSERT(t2); + return ((t1 < t2) ? -1 : 1); } static apr_status_t motorz_conn_pool_cleanup(void *baton) @@ -424,9 +419,7 @@ static apr_status_t motorz_io_process(mo motorz_io_timeout_cb, motorz_get_keep_alive_timeout(scon)); - scon->pfd.reqevents = ( - scon->cs.sense == CONN_SENSE_WANT_WRITE ? APR_POLLOUT : - APR_POLLIN) | APR_POLLHUP | APR_POLLERR; + scon->pfd.reqevents = APR_POLLIN | APR_POLLHUP | APR_POLLERR; scon->cs.sense = CONN_SENSE_DEFAULT; rv = apr_pollset_add(mz->pollset, &scon->pfd); @@ -448,7 +441,7 @@ static apr_status_t motorz_io_process(mo static apr_status_t motorz_pollset_cb(motorz_core_t *mz, apr_interval_time_t timeout) { apr_status_t rc; - const apr_pollfd_t *out_pfd; + const apr_pollfd_t *out_pfd = NULL; apr_int32_t num = 0; rc = apr_pollset_poll(mz->pollset, timeout, &num, &out_pfd); @@ -459,7 +452,7 @@ static apr_status_t motorz_pollset_cb(mo return rc; } } - while (num) { + while (num>0) { /* TODO: Error check */ motorz_io_callback(mz, out_pfd); out_pfd++; @@ -500,7 +493,7 @@ static int motorz_setup_pollset(motorz_c rv = apr_pollset_create_ex(&mz->pollset, 512, mz->pool, - APR_POLLSET_THREADSAFE | APR_POLLSET_NOCOPY | APR_POLLSET_NODEFAULT, + APR_POLLSET_NODEFAULT, good_methods[i]); if (rv == APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, ap_server_conf, APLOGNO(02852) @@ -515,7 +508,7 @@ static int motorz_setup_pollset(motorz_c rv = apr_pollset_create(&mz->pollset, 512, mz->pool, - APR_POLLSET_THREADSAFE | APR_POLLSET_NOCOPY); + 0); } if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, APLOGNO(02854) @@ -900,10 +893,9 @@ static void child_main(motorz_core_t *mz (void) ap_update_child_status(sbh, SERVER_READY, (request_rec *) NULL); -#if 0 apr_skiplist_init(&mz->timer_ring, mz->pool); apr_skiplist_set_compare(mz->timer_ring, timer_comp, timer_comp); -#endif + status = motorz_setup_workers(mz); if (status != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_CRIT, status, ap_server_conf, APLOGNO(02868) @@ -1613,7 +1605,12 @@ static int motorz_pre_config(apr_pool_t apr_pool_tag(mz->pool, "motorz-mpm-core"); apr_skiplist_init(&mz->timer_ring, mz->pool); apr_skiplist_set_compare(mz->timer_ring, timer_comp, timer_comp); - apr_thread_mutex_create(&mz->mtx, 0, mz->pool); + rv = apr_thread_mutex_create(&mz->mtx, 0, mz->pool); + if (rv != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, APLOGNO() + "motorz_pre_config: apr_thread_mutex_create failed"); + return rv; + } ap_listen_pre_config(); ap_num_kids = DEFAULT_START_DAEMON;