]> sourceware.org Git - newlib-cygwin.git/commitdiff
2013-11-29 Sebastian Huber <sebastian.huber@embedded-brains.de>
authorJoel Sherrill <joel.sherrill@oarcorp.com>
Fri, 29 Nov 2013 23:35:34 +0000 (23:35 +0000)
committerJoel Sherrill <joel.sherrill@oarcorp.com>
Fri, 29 Nov 2013 23:35:34 +0000 (23:35 +0000)
* libc/include/pthread.h (pthread_cleanup_push): Delete prototype
and add macro of the same name.
(pthread_cleanup_pop): Likewise.
(_pthread_cleanup_context): Define.
(_pthread_cleanup_push): Likewise.
(_pthread_cleanup_pop): Likewise.
(pthread_cleanup_push_defer_np): Define if _GNU_SOURCE is defined.
(pthread_cleanup_pop_restore_np): Likewise.
(_pthread_cleanup_push_defer): Likewise.
(_pthread_cleanup_pop_restore): Likewise.

newlib/ChangeLog
newlib/libc/include/pthread.h

index 850b93accedd703093c7cc1fe7199aaca8c7d115..60392b8f65fdc19c3205d2d0b180983310a770a3 100644 (file)
@@ -1,3 +1,16 @@
+2013-11-29  Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+       * libc/include/pthread.h (pthread_cleanup_push): Delete prototype
+       and add macro of the same name.
+       (pthread_cleanup_pop): Likewise.
+       (_pthread_cleanup_context): Define.
+       (_pthread_cleanup_push): Likewise.
+       (_pthread_cleanup_pop): Likewise.
+       (pthread_cleanup_push_defer_np): Define if _GNU_SOURCE is defined.
+       (pthread_cleanup_pop_restore_np): Likewise.
+       (_pthread_cleanup_push_defer): Likewise.
+       (_pthread_cleanup_pop_restore): Likewise.
+
 2013-11-29  Jennifer Averett <jennifer.averett@oarcorp.com>
 
        * libc/include/pthread.h (pthread_attr_setaffinity_np):
index 935de411985881cc395813a233ead59ebe0e4210..db1f9c1ca3c5238f4c97a09565e143149315d8e9 100644 (file)
@@ -34,6 +34,13 @@ extern "C" {
 #include <sys/sched.h>
 #include <sys/cdefs.h>
 
+struct _pthread_cleanup_context {
+  void (*_routine)(void *);
+  void *_arg;
+  int _canceltype;
+  struct _pthread_cleanup_context *_previous;
+};
+
 /* Register Fork Handlers */
 int    _EXFUN(pthread_atfork,(void (*prepare)(void), void (*parent)(void),
                    void (*child)(void)));
@@ -304,9 +311,43 @@ void       _EXFUN(pthread_testcancel, (void));
 
 /* Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184 */
 
-void   _EXFUN(pthread_cleanup_push,
-       (void (*__routine)( void * ), void *__arg));
-void   _EXFUN(pthread_cleanup_pop, (int __execute));
+void   _EXFUN(_pthread_cleanup_push,
+       (struct _pthread_cleanup_context *_context,
+       void (*_routine)(void *), void *_arg));
+
+void   _EXFUN(_pthread_cleanup_pop,
+       (struct _pthread_cleanup_context *_context,
+       int _execute));
+
+/* It is intentional to open and close the scope in two different macros */
+#define pthread_cleanup_push(_routine, _arg) \
+  do { \
+    struct _pthread_cleanup_context _pthread_clup_ctx; \
+    _pthread_cleanup_push(&_pthread_clup_ctx, (_routine), (_arg))
+
+#define pthread_cleanup_pop(_execute) \
+    _pthread_cleanup_pop(&_pthread_clup_ctx, (_execute)); \
+  } while (0)
+
+#if defined(_GNU_SOURCE)
+void   _EXFUN(_pthread_cleanup_push_defer,
+       (struct _pthread_cleanup_context *_context,
+       void (*_routine)(void *), void *_arg));
+
+void   _EXFUN(_pthread_cleanup_pop_restore,
+       (struct _pthread_cleanup_context *_context,
+       int _execute));
+
+/* It is intentional to open and close the scope in two different macros */
+#define pthread_cleanup_push_defer_np(_routine, _arg) \
+  do { \
+    struct _pthread_cleanup_context _pthread_clup_ctx; \
+    _pthread_cleanup_push_defer(&_pthread_clup_ctx, (_routine), (_arg))
+
+#define pthread_cleanup_pop_restore_np(_execute) \
+    _pthread_cleanup_pop_restore(&_pthread_clup_ctx, (_execute)); \
+  } while (0)
+#endif /* defined(_GNU_SOURCE) */
 
 #if defined(_POSIX_THREAD_CPUTIME)
  
This page took 0.054577 seconds and 5 git commands to generate.