mthread.c
Go to the documentation of this file.
1 /****************************************************************/
2 /* Multi-Thread support functions
3 /* June 8,1994 (c) Toshihiro Matsui, Electrotechnical Laboratory
4 /* added SunOS 4.1.x routine by H.Nakagaki at 29-Jun-1995
5 /*****************************************************************/
6 static char *rcsid="@(#)$Id$";
7 #if THREADED
8 
9 #include "eus.h"
10 
14 mutex_t qthread_lock;
15 
16 /* from memory.c */
17 mutex_t alloc_lock;
19 
20 /* from sequence.c */
21 mutex_t qsort_lock;
22 
23 /* from eus.c */
24 /* mutex locks*/
25 mutex_t mark_lock;
28 
29 
31 { register pointer port;
33  mutex_lock(&free_thread_lock);
34  port=ccar(free_threads);
36  mutex_unlock(&free_thread_lock);
37  return(port);}
38 
39 extern int next_special_index;
40 
41 void thread_main(port)
42 pointer port;
43 { pointer val, *spsave, argp;
44  jmp_buf thjmp;
45  context *ctx;
46  unsigned int tid, argc;
47  int i;
48  pointer myspecs, reqspecs;
49 
50  tid=thr_self();
51 
52  if (tid>=MAXTHREAD) thr_exit(0);
53  ctx=(context *)((eusinteger_t)port->c.thrp.contex & ~2L);
54  euscontexts[tid]=ctx;
55 /* fprintf(stderr, "new thread %d port=%x ctx=%x\n", tid, port, ctx); */
56  mkcatchframe(ctx, makeint(0),&thjmp);
57  mutex_lock(&free_thread_lock);
58  free_threads=cons(ctx,port, free_threads);
59  mutex_unlock(&free_thread_lock);
60 
61 thread_loop:
63  port->c.thrp.idle=T;
64  GC_REGION(sema_wait((sema_t *)(port->c.thrp.reqsem->c.ivec.iv)););
65  port->c.thrp.idle=NIL;
66  /*copy special bindings from the requester*/
67  myspecs= ctx->specials;
68  reqspecs= euscontexts[intval(port->c.thrp.requester)]->specials;
69  for (i=0; i<next_special_index; i++)
70  myspecs->c.vec.v[i]= reqspecs->c.vec.v[i];
71  sema_post((sema_t *)port->c.thrp.runsem->c.ivec.iv);
72 
73  /* funcall */
74  if ((val=(pointer)eussetjmp(thjmp))==0) {
75  spsave=ctx->vsp;
76  argp=port->c.thrp.args;
77  argc=0;
78  while (argp!=NIL) {
79  ckpush(ccar(argp)); argp=ccdr(argp); argc++;}
80 /* fprintf(stderr, "ctx=%x port=%x func=%x arg=%x argc=%d\n",
81  ctx,port,port->c.thrp.func,spsave,argc); */
82  val=(pointer)ufuncall(ctx, port,
83  port->c.thrp.func,(pointer)spsave,NULL,argc);
84  }
85  else if (val==(pointer)1) {
86  val=makeint(0); /*longjmp cannot return 0*/
87  fprintf(stderr, "thread %d reset\n", tid);}
88  port->c.thrp.result=val;
89  if (port->c.thrp.wait!=NIL) {
90  sema_post((sema_t *)port->c.thrp.donesem->c.ivec.iv);
91  GC_REGION(sema_wait((sema_t *)port->c.thrp.reqsem->c.ivec.iv););
92  /*wait for result-transfer ack*/
93  }
94  /* chain self in the free_thread list */
95  mutex_lock(&free_thread_lock);
96  free_threads=cons(ctx, port, free_threads);
97  mutex_unlock(&free_thread_lock);
98  goto thread_loop;
99  /*never reaches here*/
100  deletecontext(tid,ctx);
101  }
102 
103 pointer MAKE_THREAD(ctx, n, argv)
104 context *ctx;
105 int n;
106 pointer argv[];
107 { int stack_size, c_stack_size;
108  context *newctx;
109  pointer newport, thrlist=NIL;
110  int i,count;
111  unsigned int tid;
112 
113  ckarg2(1,3);
114  count=ckintval(argv[0]);
115  if (n>=2) stack_size=ckintval(argv[1]);
116  else stack_size=32*1024; /* default stack=32K word */
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++) {
120  newctx=(context *)makelispcontext(stack_size);
121  newport=(pointer)makethreadport(newctx);
122  ckpush(newport);
123  GC_REGION(mutex_lock(&qthread_lock););
124 #ifdef RGC
126 #endif
127  speval(QTHREADS)=cons(ctx, newport, speval(QTHREADS));
128  mutex_unlock(&qthread_lock);
129 #if alpha || PTHREAD
130  if( thr_create(0, c_stack_size, thread_main, newport, 0, &tid ) != 0 ) {
131  deletecontext(tid, ctx);
132  error(E_USER,(pointer)"Number of threads reached limit (64)");
133  }
134  newport->c.thrp.id=makeint(tid); /* ???? critical region problem */
135 #else
136  thr_create(0, c_stack_size, (void *(*)(void *))thread_main,
137  newport, THR_SUSPENDED, &tid);
138  if (tid>=MAXTHREAD) {
139  deletecontext(tid, ctx);
140  error(E_USER,(pointer)"Number of threads reached limit (64)");
141  }
142  newport->c.thrp.id=makeint(tid);
143  thr_continue(tid);
144 #endif
145  }
146  thrlist=stacknlist(ctx,count);
147  return(thrlist);}
148 
149 pointer AFUNCALL(ctx, n, argv)
150 context *ctx;
151 int n;
152 pointer argv[];
153 { register pointer port, args;
154  register int i;
155  port=get_free_thread();
156  port->c.thrp.requester=makeint(thr_self());
157  port->c.thrp.func=argv[0];
158  args=NIL;
159  for (i=1; i<n; i++) { args=cons(ctx,argv[n-i],args);}
160  port->c.thrp.args=args;
161  port->c.thrp.wait=T;
162 
163  /*resume target thread*/
164  sema_post((sema_t *)port->c.thrp.reqsem->c.ivec.iv);
165 
166  /*wait for the target start running*/
167  /*the requester should wait for the copying thread-local special variables
168  to be copied*/
169  GC_REGION(sema_wait((sema_t *)port->c.thrp.runsem->c.ivec.iv););
170  return(port);}
171 
173 context *ctx;
174 int n;
175 pointer argv[];
176 { register pointer port, args;
177  register int i;
178  port=get_free_thread();
179  port->c.thrp.requester=makeint(thr_self());
180  port->c.thrp.func=argv[0];
181  args=NIL;
182  for (i=1; i<n; i++) { args=cons(ctx,argv[n-i],args);}
183  port->c.thrp.args=args;
184  port->c.thrp.wait=NIL;
185  sema_post((sema_t *)port->c.thrp.reqsem->c.ivec.iv);
186  /*wait for the target start running*/
187  /*the requester should wait for the copying thread-local special variables
188  to be copied*/
189  GC_REGION(sema_wait((sema_t *)port->c.thrp.runsem->c.ivec.iv););
190  return(port);}
191 
193 context *ctx;
194 int n;
195 pointer argv[];
196 { register pointer port, result;
197  ckarg(1);
198  port=argv[0];
199  if (port->c.thrp.wait!=NIL &&
200  (/* port->c.thrp.idle==NIL */ 1 ||
201  port->c.thrp.reqsem->c.ivec.iv[0]>0)) {
202  GC_REGION(sema_wait((sema_t *)port->c.thrp.donesem->c.ivec.iv););
203  result=port->c.thrp.result;
204  sema_post((sema_t *)port->c.thrp.reqsem->c.ivec.iv); /*ack result transfer*/
205  return(result);}
206  else error(E_USER,(pointer)"wait thread for idle thread");}
207 
209 context *ctx;
210 int n;
211 pointer argv[];
212 { return(free_threads);}
213 
214 /* mutex lock */
215 
216 #if Linux && !Darwin
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
220 #endif
221 
223 context *ctx;
224 int n;
225 pointer argv[];
226 { register pointer m;
227  m=makevector(C_INTVECTOR, (sizeof(mutex_t)+sizeof(eusinteger_t)-1)/sizeof(eusinteger_t));
228 #if alpha
229  pthread_mutex_init((mutex_t *)m->c.ivec.iv,pthread_mutexattr_default);
230 #elif PTHREAD
231  {
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]));
236  }else{
237  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
238  }
239  pthread_mutex_init((mutex_t *)m->c.ivec.iv, &attr);
240  }
241 #else
242  mutex_init((mutex_t *)m->c.ivec.iv,USYNC_THREAD,0);
243 #endif
244  return(m);}
245 
247 context *ctx;
248 int n;
249 register pointer argv[];
250 { ckarg(1);
251  if (!isintvector(argv[0])) error(E_NOINTVECTOR);
252  mutex_lock((mutex_t *)argv[0]->c.ivec.iv);
253  return(T);}
254 
256 context *ctx;
257 int n;
258 register pointer argv[];
259 { ckarg(1);
260  if (!isintvector(argv[0])) error(E_NOINTVECTOR);
261 #if SunOS4_1
262  if (mutex_trylock((mutex_t *)argv[0]->c.ivec.iv)==-1) return(NIL);
263 #else /* for Solaris2 */
264  if (mutex_trylock((mutex_t *)argv[0]->c.ivec.iv)==EBUSY) return(NIL);
265 #endif
266  return(T);}
267 
269 context *ctx;
270 int n;
271 register pointer argv[];
272 { ckarg(1);
273  if (!isintvector(argv[0])) error(E_NOINTVECTOR);
274  mutex_unlock((mutex_t *)argv[0]->c.ivec.iv);
275  return(T);}
276 
277 /* condition variable */
278 
279 pointer MAKE_COND(ctx,n,argv)
280 context *ctx;
281 int n;
282 pointer argv[];
283 { register pointer m;
284 #if SunOS4_1
285  ckarg(1);
286 #endif
287  m=makevector(C_INTVECTOR, (sizeof(cond_t)+sizeof(eusinteger_t)-1)/sizeof(eusinteger_t));
288 #if alpha
289  pthread_cond_init((cond_t*)m->c.ivec.iv, pthread_condattr_default);
290 #elif PTHREAD
291  pthread_cond_init((cond_t*)m->c.ivec.iv, NULL);
292 #else
293 #if SunOS4_1
294  cond_init((cond_t *)m->c.ivec.iv, (mutex_t *)argv[0]->c.ivec.iv);
295 #else /* For Solaris2 */
296  cond_init((cond_t *)m->c.ivec.iv,USYNC_THREAD,0);
297 #endif
298 #endif
299  return(m);}
300 
301 pointer COND_WAIT(ctx,n,argv)
302 context *ctx;
303 int n;
304 register pointer argv[];
305 { ckarg(2);
306  if (!isintvector(argv[0]) || !isintvector(argv[0])) error(E_NOINTVECTOR);
307  cond_wait((cond_t *)argv[0]->c.ivec.iv, (mutex_t *)argv[1]->c.ivec.iv);
308  return(T);}
309 
311 context *ctx;
312 int n;
313 register pointer argv[];
314 { ckarg2(1,2);
315  if (!isintvector(argv[0])) error(E_NOINTVECTOR);
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);
318  return(T);}
319 
320 /* semaphore */
321 
323 context *ctx;
324 int n;
325 pointer argv[];
326 { pointer s;
327  s=makevector(C_INTVECTOR, (sizeof(sema_t)+sizeof(eusinteger_t)-1)/sizeof(eusinteger_t));
328  sema_init((sema_t *)s->c.ivec.iv, 0, USYNC_THREAD, 0);
329  return(s);}
330 
331 pointer SEMA_POST(ctx,n,argv)
332 context *ctx;
333 int n;
334 register pointer argv[];
335 { if (!isintvector(argv[0])) error(E_NOINTVECTOR);
336  sema_post((sema_t *)argv[0]->c.ivec.iv);
337  return(T);}
338 
339 pointer SEMA_WAIT(ctx,n,argv)
340 context *ctx;
341 int n;
342 pointer argv[];
343 { if (!isintvector(argv[0])) error(E_NOINTVECTOR);
344  GC_REGION(sema_wait((sema_t *)argv[0]->c.ivec.iv););
345  return(T);}
346 
348 context *ctx;
349 int n;
350 pointer argv[];
351 { if (!isintvector(argv[0])) error(E_NOINTVECTOR);
352  if (sema_trywait((sema_t *)argv[0]->c.ivec.iv)==0) return(T);
353  else return(NIL);}
354 
355 
356 pointer THR_SELF(ctx,n,argv)
357 register context *ctx;
358 int n;
359 pointer argv[];
360 {
361  return(makeint(thr_self()));}
362 
364 register context *ctx;
365 int n;
366 pointer argv[];
367 {
368  return(euscontexts[thr_self()]->threadobj);}
369 
371 register context *ctx;
372 int n;
373 pointer argv[];
374 { int stat;
375  ckarg(2);
376  stat=thr_setprio(ckintval(argv[0]),ckintval(argv[1]));
377  if (stat) return(makeint(-errno));
378  else return(T);}
379 
381 register context *ctx;
382 int n;
383 pointer argv[];
384 { int stat,prio;
385  ckarg(1);
386  stat=thr_getprio(ckintval(argv[0]), &prio);
387  if (stat) return(makeint(-errno));
388  else return(makeint(prio));}
389 
391 register context *ctx;
392 int n;
393 pointer argv[];
394 { int stat;
395  ckarg(1);
396 #if SunOS4_1 || alpha || PTHREAD
397  fprintf(stderr, "thr_setconcurrency is not supprted!\n");
398  stat = 0;
399 #else
400  stat=thr_setconcurrency(ckintval(argv[0]));
401 #endif
402  if (stat) return(makeint(stat));
403  else return(T);}
404 
406 register context *ctx;
407 int n;
408 pointer argv[];
409 { int concurrency;
410  ckarg(0);
411 #if SunOS4_1 || alpha || PTHREAD
412  fprintf(stderr, "thr_getconcurrency is not supprted!\n");
413  concurrency = 0;
414 #else
415  concurrency=thr_getconcurrency();
416 #endif
417  return(makeint(concurrency));}
418 
419 void newthread(ta)
420 struct thread_arg *ta;
421 { int tid;
422  pointer func,argv[1],result,val;
423  jmp_buf thjmp;
424 
425  tid=thr_self();
426  euscontexts[tid]=ta->newctx;
427  fprintf(stderr,"new thread_id=%d\n",tid);
428  mkcatchframe(ta->newctx, makeint(0),&thjmp);
429  if ((val=(pointer)eussetjmp(thjmp))==0) {
430  argv[0]=ta->arg;
431  result=ufuncall(ta->newctx, ta->form, ta->func,(pointer)argv,NULL,1);}
432  else if (val==(pointer)1) val=makeint(0); /*longjmp cannot return 0*/
433  fprintf(stderr, "thread %d terminated\n", tid);
434  deletecontext(tid,ta->newctx);
435  cfree(ta);
436  }
437 
439 register context *ctx;
440 int n;
441 pointer argv[];
442 { int stack_size,stat;
443  context *newctx;
444  unsigned int thread_id;
445  pointer result;
446  struct thread_arg *ta;
447  pointer func=argv[0], arg=argv[1];
448 
449  ckarg2(2,3);
450  if (n==3) stack_size=ckintval(argv[2]);
451  else stack_size=1024*64;
452 
453  newctx=(context *)makelispcontext(stack_size);
454  fprintf(stderr,"creater newcontext=%p\n", newctx);
455  ta=(struct thread_arg *)malloc(sizeof(struct thread_arg));
456  ta->form=ctx->callfp->form;
457  ta->newctx=newctx;
458  ta->func=func;
459  ta->arg=arg;
460  stat=thr_create(0, stack_size, (void (*)(void *))newthread,
461  ta,0,&thread_id);
462  if (stat) result=makeint(-errno);
463  else
464  result=makeint(thread_id);
465  return(result);
466  }
467 
468 pointer THR_KILL(ctx,n,argv)
469 register context *ctx;
470 int n;
471 pointer argv[];
472 { int tid;
473  int sig;
474  ckarg(2);
475  tid=ckintval(argv[0]);
476  sig=ckintval(argv[1]);
477  if (euscontexts[tid]) { thr_kill(tid,sig); return(T);}
478  else return(NIL);}
479 
481 register context *ctx;
482 int n;
483 pointer argv[];
484 { int tid;
485  ckarg(1);
486 #if alpha
487  fprintf(stderr,"thr_suspend is not implemented.\n" );
488  return(NIL);
489 #else
490  tid=ckintval(argv[0]);
491  if (euscontexts[tid]) {
492  if (thr_suspend(tid)==0) return(T);
493  else return(makeint(-errno));}
494  else return(NIL);
495 #endif
496 }
497 
499 register context *ctx;
500 int n;
501 pointer argv[];
502 { int tid;
503  ckarg(1);
504 #if alpha
505  fprintf(stderr,"thr_continue is not implemented.\n");
506  return(NIL);
507 #else
508  tid=ckintval(argv[0]);
509  if (euscontexts[tid]) {
510  if (thr_continue(tid)==0) return(T);
511  else return(makeint(-errno));}
512  else return(NIL);
513 #endif
514 }
515 
516 #if Solaris2
518 register context *ctx;
519 int n;
520 pointer argv[];
521 { int how, stat;
522  eusinteger_t *oset;
523 
524  ckarg2(2,3);
525  how=ckintval(argv[0]);
526  if (n==3) oset=argv[2]->c.ivec.iv;
527  else oset=NULL;
528  stat=thr_sigsetmask(how, argv[1]->c.ivec.iv, oset);
529  if (stat==0) {
530  if (n==3) return(argv[2]);
531  else return(T);}
532  else return(makeint(-errno));
533  }
534 #endif
535 
536 int mthread(ctx,mod)
537 register context *ctx;
538 pointer mod;
539 {
541 
542  defunpkg(ctx,"THR-SELF",mod,THR_SELF,unixpkg);
543  defunpkg(ctx,"THR-GETPRIO",mod,THR_GETPRIO,unixpkg);
544  defunpkg(ctx,"THR-SETPRIO",mod,THR_SETPRIO,unixpkg);
545  defunpkg(ctx,"THR-GETCONCURRENCY",mod,THR_GETCONCURRENCY,unixpkg);
546  defunpkg(ctx,"THR-SETCONCURRENCY",mod,THR_SETCONCURRENCY,unixpkg);
547  defunpkg(ctx,"THR-CREATE",mod,THR_CREATE,unixpkg);
548  defunpkg(ctx,"THR-KILL",mod,THR_KILL,unixpkg);
549  defunpkg(ctx,"THR-SUSPEND",mod,THR_SUSPEND,unixpkg);
550  defunpkg(ctx,"THR-CONTINUE",mod,THR_CONTINUE,unixpkg);
551 #if Solaris2
552  defunpkg(ctx,"THR-SIGSETMASK",mod,THR_SIGSETMASK,unixpkg);
553 #endif
554 
555  defunpkg(ctx,"THREAD-SELF",mod,THREAD_SELF,syspkg);
556  defunpkg(ctx,"MAKE-THREAD",mod,MAKE_THREAD,syspkg);
557  defunpkg(ctx,"THREAD",mod,AFUNCALL, syspkg);
558  defunpkg(ctx,"THREAD-NO-WAIT",mod,AFUNCALL_NO_WAIT, syspkg);
559  defunpkg(ctx,"WAIT-THREAD",mod,WAIT_AFUNCALL,syspkg);
560  defunpkg(ctx,"FREE-THREADS",mod,FREE_THREADS,syspkg);
561 
562  defunpkg(ctx,"MAKE-MUTEX-LOCK",mod,MAKE_MUTEX_LOCK,syspkg);
563  defunpkg(ctx,"MUTEX-LOCK",mod, MUTEX_LOCK,syspkg);
564  defunpkg(ctx,"MUTEX-UNLOCK",mod, MUTEX_UNLOCK,syspkg);
565  defunpkg(ctx,"MUTEX-TRYLOCK",mod, MUTEX_TRYLOCK,syspkg);
566 #if PTHREAD
567  defvar(ctx,"*PTHREAD-MUTEX-FAST*",makeint(PTHREAD_MUTEX_NORMAL),syspkg);
568  defvar(ctx,"*PTHREAD-MUTEX-RECURSIVE*",makeint(PTHREAD_MUTEX_RECURSIVE),syspkg);
569  defvar(ctx,"*PTHREAD-MUTEX-ERRORCHECK*",makeint(PTHREAD_MUTEX_ERRORCHECK),syspkg);
570 #endif
571 
572  defunpkg(ctx,"MAKE-COND",mod,MAKE_COND,syspkg);
573  defunpkg(ctx,"COND-WAIT",mod, COND_WAIT,syspkg);
574  defunpkg(ctx,"COND-SIGNAL",mod, COND_SIGNAL,syspkg);
575 
576  defunpkg(ctx,"MAKE-SEMAPHORE",mod,MAKE_SEMAPHORE,syspkg);
577  defunpkg(ctx,"SEMA-POST",mod, SEMA_POST,syspkg);
578  defunpkg(ctx,"SEMA-WAIT",mod, SEMA_WAIT,syspkg);
579  defunpkg(ctx,"SEMA-TRYWAIT",mod, SEMA_TRYWAIT,syspkg);
580  }
581 
582 #endif /* THREADED */
AFUNCALL
pointer AFUNCALL(context *ctx, int n, argv)
Definition: mthread.c:149
free_thread_sem
sema_t free_thread_sem
Definition: mthread.c:11
E_NOINTVECTOR
@ E_NOINTVECTOR
Definition: eus.h:999
threadport::runsem
pointer runsem
Definition: eus.h:358
COND_SIGNAL
pointer COND_SIGNAL(context *ctx, int n, argv)
Definition: mthread.c:310
NIL
pointer NIL
Definition: eus.c:110
cell::cellunion::thrp
struct threadport thrp
Definition: eus.h:421
QTHREADS
pointer QTHREADS
Definition: eus.c:124
get_free_thread
pointer get_free_thread()
Definition: mthread.c:30
COND_WAIT
pointer COND_WAIT(context *ctx, int n, argv)
Definition: mthread.c:301
makeint
#define makeint(v)
Definition: sfttest.c:2
threadport::requester
pointer requester
Definition: eus.h:356
context
Definition: eus.h:524
gc_lock
rwlock_t gc_lock
Definition: mthread.c:18
THREAD_SELF
pointer THREAD_SELF(context *ctx, int n, argv)
Definition: mthread.c:363
s
short s
Definition: structsize.c:2
threadport::args
pointer args
Definition: eus.h:361
thr_kill
int thr_kill(int, int)
Definition: pthreads.c:70
makevector
pointer makevector(pointer, int)
Definition: makes.c:417
mthread
int mthread(context *ctx, pointer mod)
Definition: mthread.c:536
mark_lock_thread
int mark_lock_thread
Definition: mthread.c:27
intval
#define intval(p)
Definition: sfttest.c:1
T
pointer T
Definition: eus.c:110
THR_CONTINUE
pointer THR_CONTINUE(context *ctx, int n, argv)
Definition: mthread.c:498
thread_arg::arg
pointer arg
Definition: eus_thr.h:34
pointer
struct cell * pointer
Definition: eus.h:165
active_mutator_num
#define active_mutator_num
Definition: collector.h:231
THR_SETPRIO
pointer THR_SETPRIO(context *ctx, int n, argv)
Definition: mthread.c:370
newthread
void newthread(struct thread_arg *ta)
Definition: mthread.c:419
eus.h
mkcatchframe
void mkcatchframe(context *, pointer, jmp_buf *)
Definition: makes.c:801
sema_init
int sema_init(sema_t *, unsigned int, int, void *)
Definition: pthreads.c:111
THR_GETPRIO
pointer THR_GETPRIO(context *ctx, int n, argv)
Definition: mthread.c:380
free_threads
pointer free_threads
Definition: mthread.c:12
WAIT_AFUNCALL
pointer WAIT_AFUNCALL(context *ctx, int n, argv)
Definition: mthread.c:192
context::specials
pointer specials
Definition: eus.h:545
qthread_lock
mutex_t qthread_lock
Definition: mthread.c:14
thr_setprio
int thr_setprio(int, int)
Definition: pthreads.c:30
cell::cellunion::ivec
struct intvector ivec
Definition: eus.h:416
thr_suspend
int thr_suspend(int)
Definition: pthreads.c:64
cell::c
union cell::cellunion c
threadport::result
pointer result
Definition: eus.h:362
defvar
pointer defvar(context *, char *, pointer, pointer)
Definition: makes.c:704
MUTEX_TRYLOCK
pointer MUTEX_TRYLOCK(context *ctx, int n, argv)
Definition: mthread.c:255
threadport::reqsem
pointer reqsem
Definition: eus.h:357
free_thread_lock
mutex_t free_thread_lock
Definition: mthread.c:13
FREE_THREADS
pointer FREE_THREADS(context *ctx, int n, argv)
Definition: mthread.c:208
threadport::wait
pointer wait
Definition: eus.h:365
NULL
#define NULL
Definition: transargv.c:8
defunpkg
pointer defunpkg(context *, char *, pointer, pointer(*)(), pointer)
Definition: makes.c:636
sema_trywait
int sema_trywait(sema_t *)
Definition: pthreads.c:133
MAKE_SEMAPHORE
pointer MAKE_SEMAPHORE(context *ctx, int n, argv)
Definition: mthread.c:322
THR_KILL
pointer THR_KILL(context *ctx, int n, argv)
Definition: mthread.c:468
threadport::donesem
pointer donesem
Definition: eus.h:359
vector::v
pointer v[1]
Definition: eus.h:301
euscontexts
context * euscontexts[MAXTHREAD]
Definition: eus.c:105
MUTEX_LOCK
pointer MUTEX_LOCK(context *ctx, int n, argv)
Definition: mthread.c:246
SEMA_TRYWAIT
pointer SEMA_TRYWAIT(context *ctx, int n, argv)
Definition: mthread.c:347
MAKE_THREAD
pointer MAKE_THREAD(context *ctx, int n, argv)
Definition: mthread.c:103
qsort_lock
mutex_t qsort_lock
Definition: mthread.c:21
thr_getprio
int thr_getprio(int tid, int *prio)
Definition: pthreads.c:21
MAKE_MUTEX_LOCK
pointer MAKE_MUTEX_LOCK(context *ctx, int n, argv)
Definition: mthread.c:222
syspkg
pointer syspkg
Definition: eus.c:109
THR_GETCONCURRENCY
pointer THR_GETCONCURRENCY(context *ctx, int n, argv)
Definition: mthread.c:405
SEMA_WAIT
pointer SEMA_WAIT(context *ctx, int n, argv)
Definition: mthread.c:339
next_special_index
int next_special_index
Definition: makes.c:658
unixpkg
pointer unixpkg
Definition: eus.c:109
SEMA_POST
pointer SEMA_POST(context *ctx, int n, argv)
Definition: mthread.c:331
makelispcontext
context * makelispcontext(int)
Definition: makes.c:840
cons
pointer cons(context *, pointer, pointer)
Definition: makes.c:97
threadport::id
pointer id
Definition: eus.h:355
errno
int errno
THR_SUSPEND
pointer THR_SUSPEND(context *ctx, int n, argv)
Definition: mthread.c:480
error
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
Definition: eus.c:297
count
int count
Definition: thrtest.c:11
thread_arg::func
pointer func
Definition: eus_thr.h:33
sema_wait
int sema_wait(sema_t *)
Definition: pthreads.c:124
argc
static int argc
Definition: transargv.c:56
cell
Definition: eus.h:381
mark_lock
mutex_t mark_lock
Definition: mthread.c:25
_sema
Definition: eus_thr.h:96
eusinteger_t
long eusinteger_t
Definition: eus.h:19
context::vsp
pointer * vsp
Definition: eus.h:525
rcsid
static char * rcsid
Definition: mthread.c:6
THR_CREATE
pointer THR_CREATE(context *ctx, int n, argv)
Definition: mthread.c:438
THR_SELF
pointer THR_SELF(context *ctx, int n, argv)
Definition: mthread.c:356
thread_arg
Definition: eus_thr.h:30
stacknlist
pointer stacknlist(context *, int)
Definition: makes.c:129
thr_create
int thr_create(void *, size_t, void(*)(), void *, long, int *)
Definition: pthreads.c:43
alloc_lock
mutex_t alloc_lock
Definition: mthread.c:17
threadport::func
pointer func
Definition: eus.h:360
thread_arg::form
pointer form
Definition: eus_thr.h:32
sema_post
int sema_post(sema_t *sem)
Definition: pthreads.c:148
C_INTVECTOR
pointer C_INTVECTOR
Definition: eus.c:146
mark_locking
char * mark_locking
Definition: mthread.c:26
GC_REGION
#define GC_REGION(cmp_statement)
Definition: eus.h:173
E_USER
@ E_USER
Definition: eus.h:1006
ufuncall
pointer ufuncall(context *, pointer, pointer, pointer, struct bindframe *, int)
Definition: eval.c:1469
thread_arg::newctx
context * newctx
Definition: eus_thr.h:31
makethreadport
pointer makethreadport(context *)
Definition: makes.c:916
intvector::iv
eusinteger_t iv[1]
Definition: eus.h:305
cell::cellunion::vec
struct vector vec
Definition: eus.h:414
deletecontext
void deletecontext(int, context *)
Definition: makes.c:908
tid
thread_t tid
Definition: collector.c:50
thr_continue
int thr_continue(int)
Definition: pthreads.c:58
n
GLfloat n[6][3]
Definition: cube.c:15
AFUNCALL_NO_WAIT
pointer AFUNCALL_NO_WAIT(context *ctx, int n, argv)
Definition: mthread.c:172
THR_SIGSETMASK
pointer THR_SIGSETMASK(context *ctx, int n, argv)
Definition: mthread.c:517
MUTEX_UNLOCK
pointer MUTEX_UNLOCK(context *ctx, int n, argv)
Definition: mthread.c:268
THR_SETCONCURRENCY
pointer THR_SETCONCURRENCY(context *ctx, int n, argv)
Definition: mthread.c:390
ckarg
ckarg(2)
thread_main
void thread_main(pointer port)
Definition: mthread.c:41
thr_self
unsigned int thr_self()
Definition: eus.c:25
MAKE_COND
pointer MAKE_COND(context *ctx, int n, argv)
Definition: mthread.c:279
_rwlock
Definition: eus_thr.h:101


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 15 2023 02:06:43