From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 4329 invoked from network); 20 Jun 2023 00:25:38 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 20 Jun 2023 00:25:38 -0000 Received: (qmail 5468 invoked by uid 550); 20 Jun 2023 00:25:35 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 5422 invoked from network); 20 Jun 2023 00:25:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687220722; x=1689812722; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=b2OMOV/QejGaXFjceHR5/fywmoh7SDtLsFEdPBtjWHA=; b=cXA9VIyCu9sWMk/z2vtUQBH871xrGLW/eJ+VlWypX/ij6mozprA+mLwxf9du6TWVnO Go1VRff9gqYJDmw3to7HcXzTo1u29NOfSPXwFvyxNbfEa9bYCzRG6J+/jpq/VQpNanWE CwLSgshrA5Fvb830OyQhGYuh4IXIC60e9jhvDuysRN/6yFwfBE5eAN980x0cb2fA6XMj 2V8NCOl3RK5JINIO/JzAlgPXzC4Zo9uOSzWHAjH4SweMnqNbBcIXksjeZ7wp6gyLQDyR 9ivuY+Hoks4lsJbrNoaxL4D/cBoKlmgFgxPh/tSQW64TDw0a+dcCVxYs6Jo1djJK6Z+D XSog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687220722; x=1689812722; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=b2OMOV/QejGaXFjceHR5/fywmoh7SDtLsFEdPBtjWHA=; b=Pl8hhtiISux05GHBQZCxtuyDM3KlcphjMsVDuS7q8T8PdAouMSnlSoFmpNQhUSpGvt sm3rWhoPExwVl1B+iPFbhDx/pWwHpHYmhlUBPJyIbLKFbE/N6gTTGJlDK4jsOu6oB8kU FQBssvugfDfTSkppMFs06eJrwoa2AmxGBt+6ThTgE1LTHppMbtVkmCqBmpGeZMxR9lFJ nYsTAAkCbn1FpjJ8gzlZso4koqeDAfcK91DC3dHmY/2HI9/bgs1LRJsBn4XNk33xzqSw mMmufgCDjfcP0OWPvSarwGfyl3U+HvFooUvPu3RluqvusOxmTJ5dmN4O6OaBA9eXI+G/ a56A== X-Gm-Message-State: AC+VfDyZCiLL6A1Bc1TLOLf6mNZTS6LrcI/M00bfUcsGkAAMzn55zvwh cR7bnZXJiO51ynebxIC9U2U= X-Google-Smtp-Source: ACHHUZ4kBsgkaTr2rHTlj2+V+tWYseOWSt5q28ijLaEmZMjf0BegTZTrfLOAJPSg+WXtBXi/yDU7ag== X-Received: by 2002:a05:6830:141a:b0:6b4:66ed:48d with SMTP id v26-20020a056830141a00b006b466ed048dmr4172735otp.33.1687220722051; Mon, 19 Jun 2023 17:25:22 -0700 (PDT) From: Yonggang Luo To: Jens Gustedt , musl@lists.openwall.com Cc: Yonggang Luo Date: Tue, 20 Jun 2023 08:25:03 +0800 Message-Id: <20230620002507.796-1-luoyonggang@gmail.com> X-Mailer: git-send-email 2.39.0.windows.1 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [musl] [PATCH 0/4] Add posix/pthread_mutex_clocklock posix/pthread_cond_clockdwait c2y/mtx_timedlock_monotonic c2y/cnd_timedwait_monotonic Currently, musl doesn't have pthread_mutex_clocklock pthread_cond_clockdwait, but glibc, android bionic, qnx libc already have these two functions, so implement them in musl. And for c11 threads, the mtx and cnd doesn't support for monotonic timedlock and timedwait, so add a proposaled function mtx_timedlock_monotonic cnd_timedwait_monotonic to do that. And indeed mtx_timedlock_monotonic and cnd_timedwait_monotonic can be implemented ontop of posix/pthread_mutex_clocklock posix/pthread_cond_clockdwait, so I implemented posix/pthread_mutex_clocklock posix/pthread_cond_clockdwait first in musl. I think mtx_timedlock_monotonic cnd_timedwait_monotonic is reasonable because it's newly added function and won't affect existing c11 threads functions. And it's can be implementd with glibc/qnx libc/android bionic without burden. For OS X it's can be implemented with pthread_cond_timedwait_relative_np For Windows it's can be implemented with SleepConditionVariableCS For platform have none of these, it's still can fallback to TIME_UTC When these Yonggang Luo (4): trim spaces of pthread_cond_timedwait.c and pthread_mutex_timedlock.c add pthread_mutex_clocklock and pthread_cond_clockdwait c23: Implement newly base for timespec_get c2y: Add monotonic timed wait support for threads mtx cnd .../time32/cnd_timedwait_monotonic_time32.c | 9 ++++ .../time32/mtx_timedlock_monotonic_time32.c | 9 ++++ compat/time32/pthread_cond_clockwait_time32.c | 9 ++++ .../time32/pthread_mutex_clocklock_time32.c | 9 ++++ compat/time32/time32.h | 4 ++ include/pthread.h | 4 ++ include/threads.h | 4 ++ include/time.h | 13 +++++- src/include/pthread.h | 2 + src/thread/cnd_timedwait.c | 2 +- ..._timedwait.c => cnd_timedwait_monotonic.c} | 28 ++++++------ src/thread/mtx_timedlock.c | 2 +- ..._timedlock.c => mtx_timedlock_monotonic.c} | 26 +++++------ src/thread/pthread_cond_clockwait.c | 3 ++ src/thread/pthread_cond_timedwait.c | 18 +++++--- src/thread/pthread_mutex_clocklock.c | 3 ++ src/thread/pthread_mutex_timedlock.c | 15 ++++--- src/time/timespec_get.c | 44 ++++++++++++++++++- 18 files changed, 161 insertions(+), 43 deletions(-) create mode 100644 compat/time32/cnd_timedwait_monotonic_time32.c create mode 100644 compat/time32/mtx_timedlock_monotonic_time32.c create mode 100644 compat/time32/pthread_cond_clockwait_time32.c create mode 100644 compat/time32/pthread_mutex_clocklock_time32.c copy src/thread/{cnd_timedwait.c => cnd_timedwait_monotonic.c} (52%) copy src/thread/{mtx_timedlock.c => mtx_timedlock_monotonic.c} (74%) create mode 100644 src/thread/pthread_cond_clockwait.c create mode 100644 src/thread/pthread_mutex_clocklock.c -- 2.39.0.windows.1