From b2a0fbcd48fe9328cb19d246b32c73d29f91a9ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Thu, 6 Feb 1997 04:53:48 +0100 Subject: [PATCH] Added some sproc support. Rev: src/threads.c:1.15 Rev: src/threads.h:1.10 --- src/threads.c | 9 ++++++++- src/threads.h | 22 +++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/threads.c b/src/threads.c index e5c8cdb67d..b9cc72a072 100644 --- a/src/threads.c +++ b/src/threads.c @@ -1,5 +1,5 @@ #include "global.h" -RCSID("$Id: threads.c,v 1.14 1997/01/26 22:49:14 per Exp $"); +RCSID("$Id: threads.c,v 1.15 1997/02/06 03:53:48 grubba Exp $"); int num_threads = 1; int threads_disabled = 0; @@ -11,6 +11,7 @@ int threads_disabled = 0; #include "macros.h" #include "callback.h" + struct object *thread_id; static struct callback *threads_evaluator_callback=0; @@ -99,7 +100,9 @@ void f_thread_create(INT32 args) arg=ALLOC_STRUCT(thread_starter); arg->args=aggregate_array(args); arg->id=clone(thread_id_prog,0); + tmp=th_create(&dummy,new_thread_func,arg); + if(!tmp) { num_threads++; @@ -142,6 +145,10 @@ void f_this_thread(INT32 args) void th_init() { +#ifdef SGI_SPROC_THREADS +#error /* Need to specify a filename */ + us_cookie = usinit(""); +#endif /* SGI_SPROC_THREADS */ mt_lock( & interpreter_lock); #ifdef POSIX_THREADS pthread_attr_init(&pattr); diff --git a/src/threads.h b/src/threads.h index adeb083b8f..7315555751 100644 --- a/src/threads.h +++ b/src/threads.h @@ -7,24 +7,36 @@ #ifdef _REENTRANT +/* + * Decide which type of threads to use + * + * UNIX_THREADS : Unix international threads + * POSIX_THREADS : POSIX standard threads + * SGI_SPROC_THREADS : SGI sproc() based threads + */ + +#ifdef _UNIX_THREADS #ifdef HAVE_THREAD_H #define UNIX_THREADS #include <thread.h> #undef HAVE_PTHREAD_H #undef HAVE_THREAD_H #endif +#endif /* _UNIX_THREADS */ +#ifdef _MIT_POSIX_THREADS #ifdef HAVE_PTHREAD_H #define POSIX_THREADS #include <pthread.h> #undef HAVE_PTHREAD_H #endif +#endif /* _MIT_POSIX_THREADS */ -#ifdef SPROC_THREADS +#ifdef _SGI_SPROC_THREADS /* Not supported yet */ -#undef SPROC_THREADS +#undef SGI_SPROC_THREADS #undef HAVE_SPROC -#endif /* SPROC_THREADS */ +#endif /* _SGI_SPROC_THREADS */ extern int num_threads; @@ -108,7 +120,7 @@ extern struct object *thread_id; #endif /* UNIX_THREADS */ -#ifdef SPROC_THREADS +#ifdef SGI_SPROC_THREADS /* * Not fully supported yet @@ -133,7 +145,7 @@ extern struct object *thread_id; * No cond_vars yet */ -#endif /* SPROC_THREADS */ +#endif /* SGI_SPROC_THREADS */ extern MUTEX_T interpreter_lock; -- GitLab