logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0003-trim-spaces-of-pthread_cond_timedwait.c-and-pthread_.patch (1887B)


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