about summary refs log tree commit diff
path: root/sysdeps/generic/bits/libc-lock.h
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-08-24 03:25:40 +0000
committerRoland McGrath <roland@gnu.org>2001-08-24 03:25:40 +0000
commitedb6388469813ba6f4df742ae6dd55466a28976c (patch)
treeb9e14a3e16f52fb9cb5ee34878b85f1ee8a009ec /sysdeps/generic/bits/libc-lock.h
parent0dce3d154c4af198a042bd2d1fd9241e6890a9b2 (diff)
downloadglibc-edb6388469813ba6f4df742ae6dd55466a28976c.tar.gz
glibc-edb6388469813ba6f4df742ae6dd55466a28976c.tar.xz
glibc-edb6388469813ba6f4df742ae6dd55466a28976c.zip
* sysdeps/generic/bits/libc-lock.h: Same changes.
Diffstat (limited to 'sysdeps/generic/bits/libc-lock.h')
-rw-r--r--sysdeps/generic/bits/libc-lock.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/sysdeps/generic/bits/libc-lock.h b/sysdeps/generic/bits/libc-lock.h
index ca90d35c95..700ebd6062 100644
--- a/sysdeps/generic/bits/libc-lock.h
+++ b/sysdeps/generic/bits/libc-lock.h
@@ -94,14 +94,23 @@
   } while (0)
 
 
-/* Start critical region with cleanup.  */
-#define __libc_cleanup_region_start(FCT, ARG)
-
-/* End critical region with cleanup.  */
-#define __libc_cleanup_region_end(DOIT)
+/* Start a critical region with a cleanup function */
+#define __libc_cleanup_region_start(DOIT, FCT, ARG)			    \
+{									    \
+  typeof (***(FCT)) *__save_FCT = (DOIT) ? (FCT) : 0;			    \
+  typeof (ARG) __save_ARG = ARG;					    \
+  /* close brace is in __libc_cleanup_region_end below. */
+
+/* End a critical region started with __libc_cleanup_region_start. */
+#define __libc_cleanup_region_end(DOIT)					    \
+  if ((DOIT) && __save_FCT != 0)					    \
+    (*__save_FCT)(__save_ARG);						    \
+}
 
 /* Sometimes we have to exit the block in the middle.  */
-#define __libc_cleanup_end(DOIT)
+#define __libc_cleanup_end(DOIT)					    \
+  if ((DOIT) && __save_FCT != 0)					    \
+    (*__save_FCT)(__save_ARG);						    \
 
 
 /* We need portable names for some of the functions.  */