summaryrefslogtreecommitdiffstats
path: root/sys/sys/thr.h
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2005-04-23 02:36:07 +0000
committerdavidxu <davidxu@FreeBSD.org>2005-04-23 02:36:07 +0000
commit1b8f9e10e1c77cf32fd408b1eaf5562a9c139e2b (patch)
treee146c7b3c816f2b7589eac09ea561cfebaf9ad9c /sys/sys/thr.h
parent2155a04472ed5deabbc69faec29261b585206f8b (diff)
downloadFreeBSD-src-1b8f9e10e1c77cf32fd408b1eaf5562a9c139e2b.zip
FreeBSD-src-1b8f9e10e1c77cf32fd408b1eaf5562a9c139e2b.tar.gz
Add new syscall thr_new to create thread in atomic, it will
inherit signal mask from parent thread, setup TLS and stack, and user entry address. Also support POSIX thread's PTHREAD_SCOPE_PROCESS and PTHREAD_SCOPE_SYSTEM, sysctl is also provided to control the scheduler scope.
Diffstat (limited to 'sys/sys/thr.h')
-rw-r--r--sys/sys/thr.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/sys/thr.h b/sys/sys/thr.h
index c7d5704..155e79b 100644
--- a/sys/sys/thr.h
+++ b/sys/sys/thr.h
@@ -30,7 +30,23 @@
#ifndef _SYS_THR_H_
#define _SYS_THR_H_
-#define THR_SUSPENDED 0x0001 /* Create the thread in the suspended state. */
+/* Create the thread in the suspended state. */
+#define THR_SUSPENDED 0x0001
+/* Create the system scope thread. */
+#define THR_SYSTEM_SCOPE 0x0002
+
+struct thr_param {
+ void (*start_func)(void *); /* thread entry function. */
+ void *arg; /* argument for entry function. */
+ char *stack_base; /* stack base address. */
+ size_t stack_size; /* stack size. */
+ char *tls_base; /* tls base address. */
+ size_t tls_size; /* tls size. */
+ long *child_tid; /* address to store new TID. */
+ long *parent_tid; /* parent accesses the new TID here. */
+ int flags; /* thread flags. */
+ void *spare[4]; /* TODO: cpu affinity mask etc. */
+};
/*
* See pthread_*
@@ -38,6 +54,7 @@
#ifndef _KERNEL
int thr_create(ucontext_t *ctx, long *id, int flags);
+int thr_new(struct thr_param *param, int param_size);
int thr_self(long *id);
void thr_exit(long *state);
int thr_kill(long id, int sig);
OpenPOWER on IntegriCloud