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 --- include/dirent.h | 4 ++++ include/pthread.h | 21 ++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/dirent.h b/include/dirent.h index 39fae878d7c0..f36b44f1f416 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -31,6 +31,9 @@ * SUCH DAMAGE. * * @(#)dirent.h 8.2 (Berkeley) 7/28/94 + * + * $FreeBSD$ + * */ #ifndef _DIRENT_H_ @@ -95,6 +98,7 @@ int scandir __P((const char *, struct dirent ***, int alphasort __P((const void *, const void *)); int getdirentries __P((int, char *, int, long *)); #endif /* not POSIX */ +int readdir_r __P((DIR *, struct dirent *, struct dirent **)); __END_DECLS #endif /* !KERNEL */ diff --git a/include/pthread.h b/include/pthread.h index e9e57de2135e..f4c8220f1d18 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -87,6 +87,15 @@ #define PTHREAD_PROCESS_PRIVATE 0 #define PTHREAD_PROCESS_SHARED 1 +/* + * Flags for cancelling threads + */ +#define PTHREAD_CANCEL_ENABLE 0 +#define PTHREAD_CANCEL_DISABLE 1 +#define PTHREAD_CANCEL_DEFERRED 0 +#define PTHREAD_CANCEL_ASYNCHRONOUS 2 +#define PTHREAD_CANCELED ((void *) 1) + /* * Forward structure definitions. * @@ -266,12 +275,10 @@ pthread_t pthread_self __P((void)); int pthread_setspecific __P((pthread_key_t, const void *)); int pthread_sigmask __P((int, const sigset_t *, sigset_t *)); -#ifdef NOT_YET int pthread_cancel __P((pthread_t)); int pthread_setcancelstate __P((int, int *)); int pthread_setcanceltype __P((int, int *)); void pthread_testcancel __P((void)); -#endif int pthread_getprio __P((pthread_t)); int pthread_setprio __P((pthread_t, int)); @@ -301,11 +308,11 @@ int pthread_mutexattr_setprotocol __P((pthread_mutexattr_t *, #endif #if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) -int pthread_attr_getinheritsched __P((pthread_attr_t *, int *)); -int pthread_attr_getschedparam __P((pthread_attr_t *, +int pthread_attr_getinheritsched __P((const pthread_attr_t *, int *)); +int pthread_attr_getschedparam __P((const pthread_attr_t *, struct sched_param *)); -int pthread_attr_getschedpolicy __P((pthread_attr_t *, int *)); -int pthread_attr_getscope __P((pthread_attr_t *, int *)); +int pthread_attr_getschedpolicy __P((const pthread_attr_t *, int *)); +int pthread_attr_getscope __P((const pthread_attr_t *, int *)); int pthread_attr_setinheritsched __P((pthread_attr_t *, int)); int pthread_attr_setschedparam __P((pthread_attr_t *, struct sched_param *)); @@ -314,7 +321,7 @@ int pthread_attr_setscope __P((pthread_attr_t *, int)); int pthread_getschedparam __P((pthread_t pthread, int *, struct sched_param *)); int pthread_setschedparam __P((pthread_t, int, - struct sched_param *)); + const struct sched_param *)); #endif int pthread_attr_setfloatstate __P((pthread_attr_t *, int)); -- cgit v1.3