master hovercats/oakiss / pkg / musl / patch / 0003-trim-spaces-of-pthread_cond_timedwait.c-and-pthread_.patch
 1From 167003894e360f7a868fbd9439e87c6b17902376 Mon Sep 17 00:00:00 2001
 2From: Yonggang Luo <luoyonggang@gmail.com>
 3Date: Tue, 20 Jun 2023 22:36:59 +0800
 4Subject: [PATCH] trim spaces of pthread_cond_timedwait.c and
 5 pthread_mutex_timedlock.c
 6
 7Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
 8---
 9 src/thread/pthread_cond_timedwait.c  | 6 +++---
10 src/thread/pthread_mutex_timedlock.c | 2 +-
11 2 files changed, 4 insertions(+), 4 deletions(-)
12
13diff --git a/src/thread/pthread_cond_timedwait.c b/src/thread/pthread_cond_timedwait.c
14index 6b761455..c5b35a6c 100644
15--- a/src/thread/pthread_cond_timedwait.c
16+++ b/src/thread/pthread_cond_timedwait.c
17@@ -121,12 +121,12 @@ int __pthread_cond_timedwait(pthread_cond_t *restrict c, pthread_mutex_t *restri
18 		 * via the futex notify below. */
19 
20 		lock(&c->_c_lock);
21-		
22+
23 		if (c->_c_head == &node) c->_c_head = node.next;
24 		else if (node.prev) node.prev->next = node.next;
25 		if (c->_c_tail == &node) c->_c_tail = node.prev;
26 		else if (node.next) node.next->prev = node.prev;
27-		
28+
29 		unlock(&c->_c_lock);
30 
31 		if (node.notify) {
32@@ -156,7 +156,7 @@ relock:
33 		if (val>0) a_cas(&m->_m_lock, val, val|0x80000000);
34 		unlock_requeue(&node.prev->barrier, &m->_m_lock, m->_m_type & (8|128));
35 	} else if (!(m->_m_type & 8)) {
36-		a_dec(&m->_m_waiters);		
37+		a_dec(&m->_m_waiters);
38 	}
39 
40 	/* Since a signal was consumed, cancellation is not permitted. */
41diff --git a/src/thread/pthread_mutex_timedlock.c b/src/thread/pthread_mutex_timedlock.c
42index 9279fc54..87f89287 100644
43--- a/src/thread/pthread_mutex_timedlock.c
44+++ b/src/thread/pthread_mutex_timedlock.c
45@@ -66,7 +66,7 @@ int __pthread_mutex_timedlock(pthread_mutex_t *restrict m, const struct timespec
46 	if (r != EBUSY) return r;
47 
48 	if (type&8) return pthread_mutex_timedlock_pi(m, at);
49-	
50+
51 	int spins = 100;
52 	while (spins-- && m->_m_lock && !m->_m_waiters) a_spin();
53 
54-- 
552.49.0
56