From 7285bccf1a9224fadd3b7b81be034cd04f35a820 Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Sun, 28 Nov 1999 05:38:13 +0000 Subject: add pthread_cancel, obtained from OpenBSD. eischen (Daniel Eischen) added wrappers to protect against cancled threads orphaning internal resources. the cancelability code is still a bit fuzzy but works for test programs of my own, OpenBSD's and some examples from ORA's books. add readdir_r to both libc and libc_r add some 'const' attributes to function parameters Reviewed by: eischen, jasone --- lib/libpthread/thread/thr_open.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/libpthread/thread/thr_open.c') diff --git a/lib/libpthread/thread/thr_open.c b/lib/libpthread/thread/thr_open.c index 2f30ae727c53..4e9993eb6585 100644 --- a/lib/libpthread/thread/thr_open.c +++ b/lib/libpthread/thread/thr_open.c @@ -44,10 +44,11 @@ int open(const char *path, int flags,...) { - int fd; - int mode = 0; - int status; - va_list ap; + int fd; + int mode = 0; + va_list ap; + + _thread_enter_cancellation_point(); /* Check if the file is being created: */ if (flags & O_CREAT) { @@ -68,6 +69,8 @@ open(const char *path, int flags,...) fd = -1; } + _thread_leave_cancellation_point(); + /* Return the file descriptor or -1 on error: */ return (fd); } -- cgit v1.2.3