[PATCH] Pthreads cleanup push/pop changes

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Jul 5 16:22:13 UTC 2013


On 05/07/13 17:21, Gedare Bloom wrote:
>> +#define pthread_cleanup_push(_routine, _arg) \
>> >+  do { \
>> >+    struct _pthread_cleanup_context _pthread_clup_ctx; \
>> >+    _pthread_cleanup_push(&_pthread_clup_ctx, (_routine), (_arg))
>> >+
> Does this macro work with the do-while split across two CPP defines,
> or do you need " } while (0)" here?
>
>> >+#define pthread_cleanup_pop(_execute) \
> Does this macro work, or do you need " do { \" here?
>> >+    _pthread_cleanup_pop(&_pthread_clup_ctx, (_execute)); \
>> >+  } while (0)

This split is intentional and explicitly mentioned in the POSIX 
specification.  Its also the way glibc does it.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list