From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x31.google.com (mail-oa1-x31.google.com [IPv6:2001:4860:4864:20::31]) by sourceware.org (Postfix) with ESMTPS id F35763857C4F for ; Mon, 19 Jun 2023 22:21:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F35763857C4F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-1aa291b3fc9so1390321fac.0 for ; Mon, 19 Jun 2023 15:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687213275; x=1689805275; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k4CNE9CQAgfdi+A861ITuclRRx2ttUem3Jo7X0UIuwU=; b=mhOsaqchepWwp+Fg/nRYsKSkwld+SG2Cyn4BtvA1ZzGGeqvhKeVqYqxnyp0j4yM/G/ gIQgmso7f6XBR2JoIVo5jp+t5mRdWytRdCExP3DdCfNKZs/vbe3oc6WTZanDv0BZBRWq 4lb/6NpcQoAaJpA6n1t9tV/XcQqE/CYNIJ+tG99jp62oZMFl8BLQtcp4/qQEIdbrZXne 02QxEHmozhrhDeIs3ohHMWSskjo20+sNzBWioPVVB36buPxSZMvvQrYeeJ+B2B3ZHGfu EvbJhOpBRk2zqmO3PZDOiJAaj2Ug8TDcUdY4/jB/whvUCRKkozgrGCdbj861gf4OVS2X j4mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687213275; x=1689805275; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k4CNE9CQAgfdi+A861ITuclRRx2ttUem3Jo7X0UIuwU=; b=E7X/OtBjGDZQSlAS1tmZlXfTZ56dQyYSSXjfmFioeYgldvnssU9r6BcCUehjHsIeAk nQOydZpow8029DS0bh3yPLTfAuFM0WCOP9wX5fTKFWtx9Ly1bit1y3ftaGkORxZQ6sho sY0KQe/b1X03rT80Kgi4NBxPy4oxdj0VPAk8h8DsWUjPPYvAQFxHyCc+p2VKPwuc/V/O Ga1Gxm4TkQdL+72jtW2RvmIWuHpEnm096BLIkTeTEXYUma+t1peylipF9bcbDqISuVew p/+OiC41Dm6L19thu4ovyV2up8XJmF8QsbtvYhVCqIWscAP+lW4zqOtU3saehjN8tVu+ E8bA== X-Gm-Message-State: AC+VfDyA53i33lg5cgZEQFoj+zjybjRQKpkjlAiStqXWNtccm5whRIqC UuqvvTcotnnSkAv/XcL6tLFdZUSq3aGoJA== X-Google-Smtp-Source: ACHHUZ6qTHs/LzodQC0MAmuYkOOBFU1sWm2Yq8OTNIZ8NpK+l6voi4w3nh7icXf9hqDJl3QjTWfh7w== X-Received: by 2002:a05:6870:3a26:b0:1a6:d961:fe53 with SMTP id du38-20020a0568703a2600b001a6d961fe53mr7318451oab.0.1687213275377; Mon, 19 Jun 2023 15:21:15 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id y17-20020a63e251000000b0050a0227a4bcsm161387pgj.57.2023.06.19.15.21.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 15:21:15 -0700 (PDT) From: Yonggang Luo To: Jens Gustedt , libc-alpha@sourceware.org Cc: Yonggang Luo Subject: [PATCH 4/5] c11: Switch to use pthread_mutex_clocklock and pthread_cond_clockwait to implement cnd and mtx lock and wait Date: Tue, 20 Jun 2023 06:20:51 +0800 Message-Id: <20230619222052.682-5-luoyonggang@gmail.com> X-Mailer: git-send-email 2.39.0.windows.1 In-Reply-To: <20230619222052.682-1-luoyonggang@gmail.com> References: <20230619222052.682-1-luoyonggang@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Signed-off-by: Yonggang Luo --- sysdeps/pthread/cnd_timedwait.c | 8 ++++---- sysdeps/pthread/mtx_timedlock.c | 6 +++--- sysdeps/unix/sysv/linux/cnd_timedwait.c | 4 ++-- sysdeps/unix/sysv/linux/mtx_timedlock.c | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sysdeps/pthread/cnd_timedwait.c b/sysdeps/pthread/cnd_timedwait.c index 25df50cb3a..3785fd21ba 100644 --- a/sysdeps/pthread/cnd_timedwait.c +++ b/sysdeps/pthread/cnd_timedwait.c @@ -20,10 +20,10 @@ int cnd_timedwait (cnd_t *restrict cond, mtx_t *restrict mutex, - const struct timespec* restrict time_point) + const struct timespec *restrict time_point) { - int err_code = __pthread_cond_timedwait ((pthread_cond_t *) cond, - (pthread_mutex_t *) mutex, - time_point); + int err_code = pthread_cond_clockwait ((pthread_cond_t *) cond, + (pthread_mutex_t *) mutex, + CLOCK_REALTIME, time_point); return thrd_err_map (err_code); } diff --git a/sysdeps/pthread/mtx_timedlock.c b/sysdeps/pthread/mtx_timedlock.c index a3d236f3e1..763f07d2f8 100644 --- a/sysdeps/pthread/mtx_timedlock.c +++ b/sysdeps/pthread/mtx_timedlock.c @@ -20,9 +20,9 @@ int mtx_timedlock (mtx_t *restrict mutex, - const struct timespec *restrict time_point) + const struct timespec *restrict time_point) { - int err_code = __pthread_mutex_timedlock ((pthread_mutex_t *)mutex, - time_point); + int err_code = pthread_mutex_clocklock ((pthread_mutex_t *) mutex, + CLOCK_REALTIME, time_point); return thrd_err_map (err_code); } diff --git a/sysdeps/unix/sysv/linux/cnd_timedwait.c b/sysdeps/unix/sysv/linux/cnd_timedwait.c index 9fa6d71d1a..c612d4f94d 100644 --- a/sysdeps/unix/sysv/linux/cnd_timedwait.c +++ b/sysdeps/unix/sysv/linux/cnd_timedwait.c @@ -24,9 +24,9 @@ int __cnd_timedwait64 (cnd_t *restrict cond, mtx_t *restrict mutex, const struct __timespec64 *restrict time_point) { - int err_code = __pthread_cond_timedwait64 ((pthread_cond_t *) cond, + int err_code = __pthread_cond_clockwait64 ((pthread_cond_t *) cond, (pthread_mutex_t *) mutex, - time_point); + CLOCK_REALTIME, time_point); return thrd_err_map (err_code); } diff --git a/sysdeps/unix/sysv/linux/mtx_timedlock.c b/sysdeps/unix/sysv/linux/mtx_timedlock.c index 8019792868..b8f6d51940 100644 --- a/sysdeps/unix/sysv/linux/mtx_timedlock.c +++ b/sysdeps/unix/sysv/linux/mtx_timedlock.c @@ -24,8 +24,8 @@ int __mtx_timedlock64 (mtx_t *restrict mutex, const struct __timespec64 *restrict time_point) { - int err_code = __pthread_mutex_timedlock64 ((pthread_mutex_t *)mutex, - time_point); + int err_code = __pthread_mutex_clocklock64 ((pthread_mutex_t *) mutex, + CLOCK_REALTIME, time_point); return thrd_err_map (err_code); } -- 2.39.0.windows.1