summaryrefslogtreecommitdiff
path: root/libpthread/pthread
diff options
context:
space:
mode:
authorneal <neal>2008-05-27 18:29:48 +0000
committerneal <neal>2008-05-27 18:29:48 +0000
commit66912cefeacc01baacac46d55bd8bd2bfc7d98ab (patch)
treecd7924ad5934cf14cc9512fc17832ff5c5420a76 /libpthread/pthread
parentd10c12d5d2e2b52cbea2da099155dc688b63a440 (diff)
2008-05-27 Neal H. Walfield <neal@gnu.org>
* pthread/pt-internal.h (__pthread_queue_iterate): Before returning the current element, save its next pointer. (__pthread_dequeuing_iterate): Likewise. * sysdeps/l4/hurd/pt-wakeup.c (__pthread_wakeup): Loop until we successfully wake THREAD.
Diffstat (limited to 'libpthread/pthread')
-rw-r--r--libpthread/pthread/pt-internal.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/libpthread/pthread/pt-internal.h b/libpthread/pthread/pt-internal.h
index 41fbc83..853d739 100644
--- a/libpthread/pthread/pt-internal.h
+++ b/libpthread/pthread/pt-internal.h
@@ -122,15 +122,22 @@ __pthread_dequeue (struct __pthread *thread)
}
/* Iterate over QUEUE storing each element in ELEMENT. */
-#define __pthread_queue_iterate(queue, element) \
- for (element = queue; element; element = element->next)
+#define __pthread_queue_iterate(queue, element) \
+ for (struct __pthread *__pdi_next = (queue); \
+ ((element) = __pdi_next) \
+ && ((__pdi_next = __pdi_next->next), \
+ true); \
+ )
/* Iterate over QUEUE dequeuing each element, storing it in
ELEMENT. */
-#define __pthread_dequeuing_iterate(queue, element) \
- for (element = queue; \
- element && ((element->prevp = 0), 1); \
- element = element->next)
+#define __pthread_dequeuing_iterate(queue, element) \
+ for (struct __pthread *__pdi_next = (queue); \
+ ((element) = __pdi_next) \
+ && ((__pdi_next = __pdi_next->next), \
+ ((element)->prevp = 0), \
+ true); \
+ )
/* The total number of threads currently active. */
extern atomic_fast32_t __pthread_total;