From 18571208068d5fe2f0bf7b4e980525a7f577c503 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 30 Dec 2020 07:18:30 -0500 Subject: 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. --- src/libthread/threadimpl.h | 44 -------------------------------------------- 1 file changed, 44 deletions(-) (limited to 'src/libthread/threadimpl.h') 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 #endif #include #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; -- cgit v1.2.3