From: Yonggang Luo <luoyonggang@gmail.com>
To: Jens Gustedt <jens.gustedt@inria.fr>, enh <enh@google.com>,
musl@lists.openwall.com
Cc: Yonggang Luo <luoyonggang@gmail.com>
Subject: [musl] [PATCH v3 1/5] trim spaces of pthread_cond_timedwait.c and pthread_mutex_timedlock.c
Date: Tue, 20 Jun 2023 22:36:59 +0800 [thread overview]
Message-ID: <20230620143703.1415-2-luoyonggang@gmail.com> (raw)
In-Reply-To: <20230620143703.1415-1-luoyonggang@gmail.com>
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
src/thread/pthread_cond_timedwait.c | 6 +++---
src/thread/pthread_mutex_timedlock.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/thread/pthread_cond_timedwait.c b/src/thread/pthread_cond_timedwait.c
index 6b761455..c5b35a6c 100644
--- a/src/thread/pthread_cond_timedwait.c
+++ b/src/thread/pthread_cond_timedwait.c
@@ -121,12 +121,12 @@ int __pthread_cond_timedwait(pthread_cond_t *restrict c, pthread_mutex_t *restri
* via the futex notify below. */
lock(&c->_c_lock);
-
+
if (c->_c_head == &node) c->_c_head = node.next;
else if (node.prev) node.prev->next = node.next;
if (c->_c_tail == &node) c->_c_tail = node.prev;
else if (node.next) node.next->prev = node.prev;
-
+
unlock(&c->_c_lock);
if (node.notify) {
@@ -156,7 +156,7 @@ relock:
if (val>0) a_cas(&m->_m_lock, val, val|0x80000000);
unlock_requeue(&node.prev->barrier, &m->_m_lock, m->_m_type & (8|128));
} else if (!(m->_m_type & 8)) {
- a_dec(&m->_m_waiters);
+ a_dec(&m->_m_waiters);
}
/* Since a signal was consumed, cancellation is not permitted. */
diff --git a/src/thread/pthread_mutex_timedlock.c b/src/thread/pthread_mutex_timedlock.c
index 9279fc54..87f89287 100644
--- a/src/thread/pthread_mutex_timedlock.c
+++ b/src/thread/pthread_mutex_timedlock.c
@@ -66,7 +66,7 @@ int __pthread_mutex_timedlock(pthread_mutex_t *restrict m, const struct timespec
if (r != EBUSY) return r;
if (type&8) return pthread_mutex_timedlock_pi(m, at);
-
+
int spins = 100;
while (spins-- && m->_m_lock && !m->_m_waiters) a_spin();
--
2.39.0.windows.1
next prev parent reply other threads:[~2023-06-20 14:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-20 14:36 [musl] [PATCH v3 0/5] Add posix/pthread_mutex_clocklock posix/pthread_cond_clockdwait c2y/mtx_timedlock_base c2y/cnd_timedwait_base Yonggang Luo
2023-06-20 14:36 ` Yonggang Luo [this message]
2023-06-20 14:37 ` [musl] [PATCH v3 2/5] Rename files for implement pthread_mutex_clocklock and pthread_cond_clockwait Yonggang Luo
2023-06-20 14:37 ` [musl] [PATCH v3 3/5] add pthread_mutex_clocklock and pthread_cond_clockdwait Yonggang Luo
2023-06-21 15:04 ` Rich Felker
2023-06-20 14:37 ` [musl] [PATCH v3 4/5] c23: Implement newly base for timespec_get Yonggang Luo
2023-06-20 14:37 ` [musl] [PATCH v3 5/5] c2y: Add monotonic timedlock/timedwait support for threads mtx/cnd Yonggang Luo
2023-06-20 22:47 ` [musl] [PATCH v3 0/5] Add posix/pthread_mutex_clocklock posix/pthread_cond_clockdwait c2y/mtx_timedlock_base c2y/cnd_timedwait_base Rich Felker
2023-06-21 6:10 ` 罗勇刚(Yonggang Luo)
2023-06-21 14:54 ` Rich Felker
2023-06-21 18:43 ` 罗勇刚(Yonggang Luo)
2023-06-21 18:58 ` enh
2023-06-21 6:25 ` 罗勇刚(Yonggang Luo)
2023-06-21 14:44 ` Rich Felker
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=20230620143703.1415-2-luoyonggang@gmail.com \
--to=luoyonggang@gmail.com \
--cc=enh@google.com \
--cc=jens.gustedt@inria.fr \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).