about summary refs log tree commit diff
path: root/nptl/sysdeps/pthread
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-12-12 02:28:37 +0000
committerUlrich Drepper <drepper@redhat.com>2002-12-12 02:28:37 +0000
commit000160a268fe8a04265f24278907e9602823fc61 (patch)
treec40c586fe6d993cb7c71d998241b1add550ce4b0 /nptl/sysdeps/pthread
parentf494b70b551e1d2e6d4ce4f5eec41b366cea77c1 (diff)
downloadglibc-000160a268fe8a04265f24278907e9602823fc61.tar.gz
glibc-000160a268fe8a04265f24278907e9602823fc61.tar.xz
glibc-000160a268fe8a04265f24278907e9602823fc61.zip
Update.
	* sysdeps/pthread/bits/libc-lock.h (__libc_cleanup_region_start):
	Remember function and argument even if cancellation handler
	function is not available.
	(__libc_cleanup_region_end): Execute registered function directly if
	pthread functions are not available.
	(__libc_cleanup_end): Likewise.
Diffstat (limited to 'nptl/sysdeps/pthread')
-rw-r--r--nptl/sysdeps/pthread/bits/libc-lock.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/nptl/sysdeps/pthread/bits/libc-lock.h b/nptl/sysdeps/pthread/bits/libc-lock.h
index cb2154956b..de2ec7bb25 100644
--- a/nptl/sysdeps/pthread/bits/libc-lock.h
+++ b/nptl/sysdeps/pthread/bits/libc-lock.h
@@ -336,23 +336,28 @@ typedef pthread_key_t __libc_key_t;
 /* Start critical region with cleanup.  */
 #define __libc_cleanup_region_start(DOIT, FCT, ARG) \
   { struct _pthread_cleanup_buffer _buffer;				      \
-    int _avail = (DOIT) && _pthread_cleanup_push_defer != NULL;		      \
+    int _avail = _pthread_cleanup_push_defer != NULL;			      \
     if (_avail) {							      \
       _pthread_cleanup_push_defer (&_buffer, (FCT), (ARG));		      \
+    } else if (DOIT) {							      \
+      _buffer.__routine = (FCT);					      \
+      _buffer.__arg = (ARG);						      \
     }
 
 /* End critical region with cleanup.  */
 #define __libc_cleanup_region_end(DOIT) \
     if (_avail) {							      \
       _pthread_cleanup_pop_restore (&_buffer, (DOIT));			      \
-    }									      \
+    } else if (DOIT)							      \
+      _buffer.__routine (_buffer.__arg);				      \
   }
 
 /* Sometimes we have to exit the block in the middle.  */
 #define __libc_cleanup_end(DOIT) \
     if (_avail) {							      \
       _pthread_cleanup_pop_restore (&_buffer, (DOIT));			      \
-    }
+    } else if (DOIT)							      \
+      _buffer.__routine (_buffer.__arg)
 
 /* Create thread-specific key.  */
 #define __libc_key_create(KEY, DESTRUCTOR) \