summaryrefslogtreecommitdiff
path: root/pthread
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2008-05-27 18:29:48 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-04-07 23:15:57 +0200
commit9acc87073cfc18eaa2ea5b46fa81f239d6b32b31 (patch)
tree6fdf1dea70c026889ea3cebc0f2f1ad69c1b2185 /pthread
parentb80d473696a1664926a10af0f473237cde1c1cdb (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 'pthread')
-rw-r--r--pthread/pt-internal.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/pthread/pt-internal.h b/pthread/pt-internal.h
index 41fbc830..853d739d 100644
--- a/pthread/pt-internal.h
+++ b/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;