Go to the documentation of this file.
6 static char *
rcsid=
"@(#)$Id$";
52 if (
tid>=MAXTHREAD) thr_exit(0);
65 port->c.thrp.idle=
NIL;
74 if ((val=(
pointer)eussetjmp(thjmp))==0) {
79 ckpush(ccar(argp)); argp=ccdr(argp);
argc++;}
87 fprintf(stderr,
"thread %d reset\n",
tid);}
88 port->c.thrp.result=val;
89 if (port->c.thrp.wait!=
NIL) {
107 {
int stack_size, c_stack_size;
114 count=ckintval(argv[0]);
115 if (
n>=2) stack_size=ckintval(argv[1]);
116 else stack_size=32*1024;
117 if (
n==3) c_stack_size=ckintval(argv[2]);
118 else c_stack_size=stack_size*
sizeof(
pointer);
119 for (i=0; i<
count; i++) {
137 newport, THR_SUSPENDED, &
tid);
138 if (
tid>=MAXTHREAD) {
159 for (i=1; i<
n; i++) { args=
cons(ctx,argv[
n-i],args);}
182 for (i=1; i<
n; i++) { args=
cons(ctx,argv[
n-i],args);}
196 {
register pointer port, result;
217 #define PTHREAD_MUTEX_NORMAL PTHREAD_MUTEX_ADAPTIVE_NP
218 #define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
219 #define PTHREAD_MUTEX_ERRORCHECK PTHREAD_MUTEX_ERRORCHECK_NP
229 pthread_mutex_init((mutex_t *)m->
c.
ivec.
iv,pthread_mutexattr_default);
232 pthread_mutexattr_t attr;
233 pthread_mutexattr_init(&attr);
234 if (
n==1 && isint(argv[0])) {
235 pthread_mutexattr_settype(&attr,
intval(argv[0]));
237 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
239 pthread_mutex_init((mutex_t *)m->
c.
ivec.
iv, &attr);
242 mutex_init((mutex_t *)m->
c.
ivec.
iv,USYNC_THREAD,0);
252 mutex_lock((mutex_t *)argv[0]->c.ivec.iv);
262 if (mutex_trylock((mutex_t *)argv[0]->c.ivec.iv)==-1)
return(
NIL);
264 if (mutex_trylock((mutex_t *)argv[0]->c.ivec.iv)==EBUSY)
return(
NIL);
274 mutex_unlock((mutex_t *)argv[0]->c.ivec.iv);
289 pthread_cond_init((cond_t*)m->
c.
ivec.
iv, pthread_condattr_default);
296 cond_init((cond_t *)m->
c.
ivec.
iv,USYNC_THREAD,0);
307 cond_wait((cond_t *)argv[0]->c.ivec.iv, (mutex_t *)argv[1]->
c.
ivec.
iv);
316 if (
n==2 && argv[1]!=
NIL) cond_broadcast((cond_t *)argv[0]->c.ivec.iv);
317 else cond_signal((cond_t *)argv[0]->c.ivec.iv);
376 stat=
thr_setprio(ckintval(argv[0]),ckintval(argv[1]));
396 #if SunOS4_1 || alpha || PTHREAD
397 fprintf(stderr,
"thr_setconcurrency is not supprted!\n");
400 stat=thr_setconcurrency(ckintval(argv[0]));
402 if (stat)
return(
makeint(stat));
411 #if SunOS4_1 || alpha || PTHREAD
412 fprintf(stderr,
"thr_getconcurrency is not supprted!\n");
415 concurrency=thr_getconcurrency();
427 fprintf(stderr,
"new thread_id=%d\n",
tid);
429 if ((val=(
pointer)eussetjmp(thjmp))==0) {
433 fprintf(stderr,
"thread %d terminated\n",
tid);
442 {
int stack_size,stat;
444 unsigned int thread_id;
450 if (
n==3) stack_size=ckintval(argv[2]);
451 else stack_size=1024*64;
454 fprintf(stderr,
"creater newcontext=%p\n",
newctx);
456 ta->
form=ctx->callfp->form;
475 tid=ckintval(argv[0]);
476 sig=ckintval(argv[1]);
487 fprintf(stderr,
"thr_suspend is not implemented.\n" );
490 tid=ckintval(argv[0]);
505 fprintf(stderr,
"thr_continue is not implemented.\n");
508 tid=ckintval(argv[0]);
525 how=ckintval(argv[0]);
528 stat=thr_sigsetmask(how, argv[1]->c.ivec.iv, oset);
530 if (
n==3)
return(argv[2]);
pointer AFUNCALL(context *ctx, int n, argv)
pointer COND_SIGNAL(context *ctx, int n, argv)
pointer get_free_thread()
pointer COND_WAIT(context *ctx, int n, argv)
pointer THREAD_SELF(context *ctx, int n, argv)
pointer makevector(pointer, int)
int mthread(context *ctx, pointer mod)
pointer THR_CONTINUE(context *ctx, int n, argv)
#define active_mutator_num
pointer THR_SETPRIO(context *ctx, int n, argv)
void newthread(struct thread_arg *ta)
void mkcatchframe(context *, pointer, jmp_buf *)
int sema_init(sema_t *, unsigned int, int, void *)
pointer THR_GETPRIO(context *ctx, int n, argv)
pointer WAIT_AFUNCALL(context *ctx, int n, argv)
int thr_setprio(int, int)
pointer defvar(context *, char *, pointer, pointer)
pointer MUTEX_TRYLOCK(context *ctx, int n, argv)
pointer FREE_THREADS(context *ctx, int n, argv)
pointer defunpkg(context *, char *, pointer, pointer(*)(), pointer)
int sema_trywait(sema_t *)
pointer MAKE_SEMAPHORE(context *ctx, int n, argv)
pointer THR_KILL(context *ctx, int n, argv)
context * euscontexts[MAXTHREAD]
pointer MUTEX_LOCK(context *ctx, int n, argv)
pointer SEMA_TRYWAIT(context *ctx, int n, argv)
pointer MAKE_THREAD(context *ctx, int n, argv)
int thr_getprio(int tid, int *prio)
pointer MAKE_MUTEX_LOCK(context *ctx, int n, argv)
pointer THR_GETCONCURRENCY(context *ctx, int n, argv)
pointer SEMA_WAIT(context *ctx, int n, argv)
pointer SEMA_POST(context *ctx, int n, argv)
context * makelispcontext(int)
pointer cons(context *, pointer, pointer)
pointer THR_SUSPEND(context *ctx, int n, argv)
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
pointer THR_CREATE(context *ctx, int n, argv)
pointer THR_SELF(context *ctx, int n, argv)
pointer stacknlist(context *, int)
int thr_create(void *, size_t, void(*)(), void *, long, int *)
int sema_post(sema_t *sem)
#define GC_REGION(cmp_statement)
pointer ufuncall(context *, pointer, pointer, pointer, struct bindframe *, int)
pointer makethreadport(context *)
void deletecontext(int, context *)
pointer AFUNCALL_NO_WAIT(context *ctx, int n, argv)
pointer THR_SIGSETMASK(context *ctx, int n, argv)
pointer MUTEX_UNLOCK(context *ctx, int n, argv)
pointer THR_SETCONCURRENCY(context *ctx, int n, argv)
void thread_main(pointer port)
pointer MAKE_COND(context *ctx, int n, argv)
euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 15 2023 02:06:43