public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Yonggang Luo <luoyonggang@gmail.com>
To: Jens Gustedt <jens.gustedt@inria.fr>, libc-alpha@sourceware.org
Cc: Yonggang Luo <luoyonggang@gmail.com>
Subject: [PATCH 0/5] c2y proposal add monotonicwait support for mtx and ctx
Date: Tue, 20 Jun 2023 06:20:47 +0800	[thread overview]
Message-ID: <20230619222052.682-1-luoyonggang@gmail.com> (raw)

Currently the c11 threads mtx and cnd only support for mtx_timedlock
and cnd_timedwait that use TIME_UTC, and it's not monotonic, for application
want monotonic wait/lock, then they can not use c11 threads,
So here I proposaled functions:
int mtx_timedlock_monotonic( mtx_t *restrict mutex,
                             const struct timespec *restrict time_point );
int cnd_timedwait_monotonic( cnd_t* restrict cond, mtx_t* restrict mutex,
                             const struct timespec* restrict time_point );

to support monotonic lock/wait for mtx/cnd .

Yonggang Luo (5):
  features: Rename __GLIBC_USE_ISOC2X to __GLIBC_USE_ISOC23
  time: Implement c23 timespec_get base
  clang-format: should format with 2 space and do not usage tab
  c11: Switch to use pthread_mutex_clocklock and pthread_cond_clockwait
    to implement cnd and mtx lock and wait
  c2y: Add function cnd_timedwait_monotonic and mtx_timedlock_monotonic

 .clang-format                                 |   4 +-
 conform/data/threads.h-data                   |   2 +
 include/features.h                            |   4 +-
 nptl/Versions                                 |   5 +
 sysdeps/pthread/Makefile                      |   2 +
 sysdeps/pthread/cnd_timedwait.c               |   8 +-
 ..._timedwait.c => cnd_timedwait_monotonic.c} |  58 +++++-----
 sysdeps/pthread/mtx_timedlock.c               |   6 +-
 ..._timedlock.c => mtx_timedlock_monotonic.c} |  56 +++++-----
 sysdeps/pthread/threads.h                     |  16 +++
 sysdeps/unix/sysv/linux/Versions              |   6 ++
 sysdeps/unix/sysv/linux/cnd_timedwait.c       |   4 +-
 ..._timedwait.c => cnd_timedwait_monotonic.c} |  18 ++--
 sysdeps/unix/sysv/linux/mtx_timedlock.c       |   4 +-
 ..._timedlock.c => mtx_timedlock_monotonic.c} | 100 +++++++++---------
 sysdeps/unix/sysv/linux/thrd_priv.h           |   8 ++
 time/time.h                                   |  13 +++
 time/timespec_get.c                           |  48 ++++++++-
 18 files changed, 228 insertions(+), 134 deletions(-)
 copy sysdeps/pthread/{cnd_timedwait.c => cnd_timedwait_monotonic.c} (70%)
 copy sysdeps/pthread/{mtx_timedlock.c => mtx_timedlock_monotonic.c} (75%)
 copy sysdeps/unix/sysv/linux/{cnd_timedwait.c => cnd_timedwait_monotonic.c} (68%)
 copy sysdeps/unix/sysv/linux/{mtx_timedlock.c => mtx_timedlock_monotonic.c} (59%)

-- 
2.39.0.windows.1


             reply	other threads:[~2023-06-19 22:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-19 22:20 Yonggang Luo [this message]
2023-06-19 22:20 ` [PATCH 1/5] features: Rename __GLIBC_USE_ISOC2X to __GLIBC_USE_ISOC23 Yonggang Luo
2023-06-20 20:21   ` Joseph Myers
2023-06-21  6:32     ` 罗勇刚(Yonggang Luo)
2023-06-19 22:20 ` [PATCH 2/5] time: Implement c23 timespec_get base Yonggang Luo
2023-06-20 12:44   ` Florian Weimer
2023-06-20 16:10     ` 罗勇刚(Yonggang Luo)
2023-06-20 20:25   ` Joseph Myers
2023-06-19 22:20 ` [PATCH 3/5] clang-format: should format with 2 space and do not usage tab Yonggang Luo
2023-06-19 22:20 ` [PATCH 4/5] c11: Switch to use pthread_mutex_clocklock and pthread_cond_clockwait to implement cnd and mtx lock and wait Yonggang Luo
2023-06-20  9:15   ` Florian Weimer
2023-06-19 22:20 ` [PATCH 5/5] c2y: Add function cnd_timedwait_monotonic and mtx_timedlock_monotonic Yonggang Luo
2023-06-20 20:29   ` Joseph Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230619222052.682-1-luoyonggang@gmail.com \
    --to=luoyonggang@gmail.com \
    --cc=jens.gustedt@inria.fr \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).