aboutsummaryrefslogtreecommitdiff
path: root/src/libthread/threadimpl.h
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2020-12-30 07:18:30 -0500
committerRuss Cox <rsc@swtch.com>2020-12-30 07:53:28 -0500
commit18571208068d5fe2f0bf7b4e980525a7f577c503 (patch)
treebaf2061164df38258cc6127a102ab76d9089fb31 /src/libthread/threadimpl.h
parente68f07d46f5f168dc2076286627279540bf1f99e (diff)
downloadplan9port-18571208068d5fe2f0bf7b4e980525a7f577c503.tar.gz
plan9port-18571208068d5fe2f0bf7b4e980525a7f577c503.tar.bz2
plan9port-18571208068d5fe2f0bf7b4e980525a7f577c503.zip
libthread: simplify
Now that everything uses pthreads and pthreadperthread, can delete various conditionals, all the custom context code, and so on. Also update documents. Fixes #355.
Diffstat (limited to 'src/libthread/threadimpl.h')
-rw-r--r--src/libthread/threadimpl.h44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/libthread/threadimpl.h b/src/libthread/threadimpl.h
index 14646031..9eddba21 100644
--- a/src/libthread/threadimpl.h
+++ b/src/libthread/threadimpl.h
@@ -9,36 +9,11 @@
# if defined(__APPLE__)
# define _XOPEN_SOURCE /* for Snow Leopard */
# endif
-# include <ucontext.h>
#endif
#include <sys/utsname.h>
#include "libc.h"
#include "thread.h"
-#if defined(__OpenBSD__)
-# define mcontext libthread_mcontext
-# define mcontext_t libthread_mcontext_t
-# define ucontext libthread_ucontext
-# define ucontext_t libthread_ucontext_t
-# if defined __i386__
-# include "386-ucontext.h"
-# elif defined __amd64__
-# include "x86_64-ucontext.h"
-# else
-# include "power-ucontext.h"
-# endif
-extern pid_t rfork_thread(int, void*, int(*)(void*), void*);
-#endif
-
-#if defined(__arm__)
-int mygetmcontext(ulong*);
-void mysetmcontext(const ulong*);
-#define setcontext(u) mysetmcontext(&(u)->uc_mcontext.arm_r0)
-#define getcontext(u) mygetmcontext(&(u)->uc_mcontext.arm_r0)
-#endif
-
-
-typedef struct Context Context;
typedef struct Execjob Execjob;
typedef struct Proc Proc;
typedef struct _Procrendez _Procrendez;
@@ -54,11 +29,6 @@ enum
STACK = 8192
};
-struct Context
-{
- ucontext_t uc;
-};
-
struct Execjob
{
int *fd;
@@ -72,11 +42,7 @@ struct _Procrendez
{
Lock *l;
int asleep;
-#ifdef PLAN9PORT_USING_PTHREADS
pthread_cond_t cond;
-#else
- int pid;
-#endif
};
struct _Thread
@@ -85,15 +51,10 @@ struct _Thread
_Thread *prev;
_Thread *allnext;
_Thread *allprev;
- Context context;
void (*startfn)(void*);
void *startarg;
uint id;
-#ifdef PLAN9PORT_USING_PTHREADS
pthread_t osprocid;
-#else
- int osprocid;
-#endif
uchar *stk;
uint stksize;
int exiting;
@@ -115,11 +76,7 @@ struct Proc
Proc *next;
Proc *prev;
char msg[128];
-#ifdef PLAN9PORT_USING_PTHREADS
pthread_t osprocid;
-#else
- int osprocid;
-#endif
Lock lock;
int nswitch;
_Thread *thread0;
@@ -133,7 +90,6 @@ struct Proc
_Procrendez runrend;
Lock schedlock;
_Thread *schedthread;
- Context schedcontext;
void *udata;
Jmp sigjmp;
int mainproc;