summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>1999-11-28 05:38:13 +0000
committeralfred <alfred@FreeBSD.org>1999-11-28 05:38:13 +0000
commite7efcb5302ff3b4faef7cf619f51a4b4a509f09a (patch)
tree295e248e2503f8c817b16353f285d30439bf4bf4 /include
parentdff67f0b84733be29e807fc281e817bc8639fd70 (diff)
downloadFreeBSD-src-e7efcb5302ff3b4faef7cf619f51a4b4a509f09a.zip
FreeBSD-src-e7efcb5302ff3b4faef7cf619f51a4b4a509f09a.tar.gz
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
Diffstat (limited to 'include')
-rw-r--r--include/dirent.h4
-rw-r--r--include/pthread.h21
2 files changed, 18 insertions, 7 deletions
diff --git a/include/dirent.h b/include/dirent.h
index 39fae87..f36b44f 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 e9e57de..f4c8220 100644
--- a/include/pthread.h
+++ b/include/pthread.h
@@ -88,6 +88,15 @@
#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.
*
* These are mostly opaque to the user.
@@ -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));
OpenPOWER on IntegriCloud