Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0DA7B200C4D for ; Wed, 5 Apr 2017 19:07:44 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0C55D160B94; Wed, 5 Apr 2017 17:07:44 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5116B160B76 for ; Wed, 5 Apr 2017 19:07:43 +0200 (CEST) Received: (qmail 70765 invoked by uid 500); 5 Apr 2017 17:07:42 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 70756 invoked by uid 99); 5 Apr 2017 17:07:42 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Apr 2017 17:07:42 +0000 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 D28E53A06C9 for ; Wed, 5 Apr 2017 17:07:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1790301 - /apr/apr/branches/1.6.x/locks/unix/misc.c Date: Wed, 05 Apr 2017 17:07:41 -0000 To: commits@apr.apache.org From: jim@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20170405170741.D28E53A06C9@svn01-us-west.apache.org> archived-at: Wed, 05 Apr 2017 17:07:44 -0000 Author: jim Date: Wed Apr 5 17:07:41 2017 New Revision: 1790301 URL: http://svn.apache.org/viewvc?rev=1790301&view=rev Log: semtimedop() takes a delta time, so accept what is given as the "time remaining" Modified: apr/apr/branches/1.6.x/locks/unix/misc.c Modified: apr/apr/branches/1.6.x/locks/unix/misc.c URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/locks/unix/misc.c?rev=1790301&r1=1790300&r2=1790301&view=diff ============================================================================== --- apr/apr/branches/1.6.x/locks/unix/misc.c (original) +++ apr/apr/branches/1.6.x/locks/unix/misc.c Wed Apr 5 17:07:41 2017 @@ -146,41 +146,23 @@ int sem_timedwait(sem_t * sem, const str #if APR_HAS_SYSVSEM_SERIALIZE #if !HAVE_SEMTIMEDOP extern int semtimedop(int semid, struct sembuf *sops, unsigned nsops, - const struct timespec *abs_timeout); + const struct timespec *timeout); /* * A semtimedop() impl for OSX/macOS, which lacks the * real thing. */ int semtimedop(int semid, struct sembuf *sops, unsigned nsops, - const struct timespec *abs_timeout) + const struct timespec *timeout) { int rv; - struct timespec remaining, ts, tod; - apr_time_t now; + struct timespec remaining, ts; struct sembuf proc_mutex_op_try; proc_mutex_op_try.sem_num = 0; proc_mutex_op_try.sem_op = -1; proc_mutex_op_try.sem_flg = SEM_UNDO | IPC_NOWAIT; - remaining = *abs_timeout; - now = apr_time_now(); - tod.tv_sec = apr_time_sec(now); - tod.tv_nsec = apr_time_usec(now) * 1000; /* nanoseconds */ - - remaining.tv_sec -= tod.tv_sec; - if (tod.tv_nsec <= remaining.tv_nsec) { - remaining.tv_nsec -= tod.tv_nsec; - } - else { - remaining.tv_sec--; - remaining.tv_nsec = - (NANOSECS_PER_SEC - (tod.tv_nsec - remaining.tv_nsec)); - } - /* If we had a REALLY small timeout ;) */ - if (remaining.tv_sec < 0) { - return ETIMEDOUT; - } + remaining = *timeout; errno = 0; while (((rv = semop(semid, &proc_mutex_op_try, nsops)) != 0) && (errno == EAGAIN)) {