public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] c2y proposal add monotonicwait support for mtx and ctx
@ 2023-06-20 17:17 Yonggang Luo
  2023-06-20 17:17 ` [PATCH v2 1/4] clang-format: should format with 2 space and do not usage tab Yonggang Luo
                   ` (4 more replies)
  0 siblings, 5 replies; 48+ messages in thread
From: Yonggang Luo @ 2023-06-20 17:17 UTC (permalink / raw)
  To: Jens Gustedt, libc-alpha; +Cc: Florian Weimer, Yonggang Luo

For c11 threads, the mtx and cnd doesn't support for monotonic timedlock and timedwait;
So add two proposal function mtx_timedlock_base cnd_timedwait_base to do that.
The protype of these two functions is:

int mtx_timedlock_base(mtx_t *restrict m, int time_base, const struct timespec *restrict ts);

int cnd_timedwait_base(cnd_t *restrict c, mtx_t *restrict m, int time_base, const struct timespec *restrict ts);

The time_base at least can be TIME_UTC/TIME_MONOTONIC, the implementer can implement it with any provided
TIME_* base parameter provided in c2y time.h, if TIME_MONOTONIC can not natively supported, fallback to TIME_UTC
should provided, for other TIME_* base parameter, it's implementer's choice.

Yonggang Luo (4):
  clang-format: should format with 2 space and do not usage tab
  time: Implement c23 timespec_get base
  c11: Switch to use pthread_mutex_clocklock and pthread_cond_clockwait
    to implement cnd and mtx lock and wait
  c2y: Add function cnd_timedwait_base and mtx_timedlock_base

 .clang-format                                 |   4 +-
 conform/data/threads.h-data                   |   2 +
 htl/Versions                                  |   5 +
 nptl/Versions                                 |   5 +
 sysdeps/pthread/Makefile                      |   2 +
 sysdeps/pthread/cnd_timedwait.c               |   8 +-
 .../{cnd_timedwait.c => cnd_timedwait_base.c} |  58 +++++-----
 sysdeps/pthread/mtx_timedlock.c               |   6 +-
 .../{mtx_timedlock.c => mtx_timedlock_base.c} |  56 +++++-----
 sysdeps/pthread/threads.h                     |  18 ++++
 sysdeps/unix/sysv/linux/Versions              |   6 ++
 sysdeps/unix/sysv/linux/cnd_timedwait.c       |   4 +-
 .../{cnd_timedwait.c => cnd_timedwait_base.c} |  24 +++--
 sysdeps/unix/sysv/linux/mtx_timedlock.c       |   4 +-
 .../{mtx_timedlock.c => mtx_timedlock_base.c} | 100 +++++++++---------
 sysdeps/unix/sysv/linux/thrd_priv.h           |  10 ++
 time/time.h                                   |  13 ++-
 time/timespec_get.c                           |  51 ++++++++-
 18 files changed, 240 insertions(+), 136 deletions(-)
 copy sysdeps/pthread/{cnd_timedwait.c => cnd_timedwait_base.c} (70%)
 copy sysdeps/pthread/{mtx_timedlock.c => mtx_timedlock_base.c} (75%)
 copy sysdeps/unix/sysv/linux/{cnd_timedwait.c => cnd_timedwait_base.c} (60%)
 copy sysdeps/unix/sysv/linux/{mtx_timedlock.c => mtx_timedlock_base.c} (60%)

-- 
2.39.0.windows.1


^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2023-06-22 21:48 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-20 17:17 [PATCH v2 0/4] c2y proposal add monotonicwait support for mtx and ctx Yonggang Luo
2023-06-20 17:17 ` [PATCH v2 1/4] clang-format: should format with 2 space and do not usage tab Yonggang Luo
2023-06-20 17:45   ` Zack Weinberg
2023-06-21  6:31     ` 罗勇刚(Yonggang Luo)
2023-06-21  6:47       ` Xi Ruoyao
2023-06-21  6:55         ` 罗勇刚(Yonggang Luo)
2023-06-21  7:13           ` Xi Ruoyao
2023-06-21  7:36             ` 罗勇刚(Yonggang Luo)
2023-06-21 14:26       ` Zack Weinberg
2023-06-21  7:17     ` Xi Ruoyao
2023-06-21 16:19     ` Carlos O'Donell
2023-06-21 17:35       ` Joseph Myers
2023-06-21 17:41         ` 罗勇刚(Yonggang Luo)
2023-06-21 17:49           ` Andrew Pinski
2023-06-21 17:59             ` 罗勇刚(Yonggang Luo)
2023-06-21 18:31               ` Arsen Arsenović
2023-06-21 18:42                 ` 罗勇刚(Yonggang Luo)
2023-06-21 19:36           ` Zack Weinberg
2023-06-21 21:26         ` Paul Eggert
2023-06-22 21:43           ` Joseph Myers
2023-06-22 21:48             ` Paul Eggert
2023-06-20 17:17 ` [PATCH v2 2/4] time: Implement c23 timespec_get base Yonggang Luo
2023-06-20 20:37   ` Joseph Myers
2023-06-21  6:42     ` 罗勇刚(Yonggang Luo)
2023-06-20 17:17 ` [PATCH v2 3/4] c11: Switch to use pthread_mutex_clocklock and pthread_cond_clockwait to implement cnd and mtx lock and wait Yonggang Luo
2023-06-20 17:17 ` [PATCH v2 4/4] c2y: Add function cnd_timedwait_base and mtx_timedlock_base Yonggang Luo
2023-06-20 20:41   ` Joseph Myers
2023-06-21  9:21     ` 罗勇刚(Yonggang Luo)
2023-06-21  9:54       ` Xi Ruoyao
2023-06-21 10:16         ` 罗勇刚(Yonggang Luo)
2023-06-21 10:25           ` Xi Ruoyao
2023-06-21 10:40           ` Florian Weimer
2023-06-21 13:23             ` Jₑₙₛ Gustedt
2023-06-21 12:09       ` Joseph Myers
2023-06-21 14:30       ` enh
2023-06-21 15:08         ` Joseph Myers
2023-06-21 18:39         ` 罗勇刚(Yonggang Luo)
2023-06-21 19:04           ` enh
2023-06-21 19:07             ` 罗勇刚(Yonggang Luo)
2023-06-21 19:18               ` enh
2023-06-21 19:38                 ` 罗勇刚(Yonggang Luo)
2023-06-21 19:41                   ` enh
2023-06-21 20:14                     ` 罗勇刚(Yonggang Luo)
2023-06-21 19:43                 ` 罗勇刚(Yonggang Luo)
2023-06-20 20:50   ` Joseph Myers
2023-06-20 20:45 ` [PATCH v2 0/4] c2y proposal add monotonicwait support for mtx and ctx Joseph Myers
2023-06-21  6:52   ` 罗勇刚(Yonggang Luo)
2023-06-21  7:14     ` Xi Ruoyao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).