2 * lwpint.h -- lwp internal structures
4 * Copyright (C) 1991-3 Stephen Crane.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 * author: Stephen Crane, (jsc@doc.ic.ac.uk), Department of Computing,
21 * Imperial College of Science, Technology and Medicine, 180 Queen's
22 * Gate, London SW7 2BZ, England.
27 /* `liveness' counter: check signals every `n' visits to the scheduler */
28 /* note: the lower this value, the more responsive the system but the */
29 /* more inefficient the context switch time */
33 int lwpSave _PROTO((jmp_buf));
34 void lwpRestore _PROTO((jmp_buf));
37 #if defined(MIPS) || defined(AIX32) || defined(ALPHA) || defined(__vax)
38 int lwpSave _PROTO((jmp_buf));
39 void lwpRestore _PROTO((jmp_buf));
41 #define lwpSave(x) _setjmp(x)
42 #define lwpRestore(x) _longjmp(x, 1)
43 #elif defined (UCONTEXT)
44 #define lwpSave(x) getcontext(&(x))
45 #define lwpRestore(x) setcontext(&(x))
48 #define lwpSave(x) setjmp(x)
49 #define lwpRestore(x) longjmp(x, 1)
52 #define lwpSave(x) setjmp(x)
53 #define lwpRestore(x) longjmp(x, 1)
59 /* AIX needs 12 extra bytes above the stack; we add it here */
60 #define LWP_EXTRASTACK 3*sizeof(long)
62 #define LWP_EXTRASTACK 0
65 #define LWP_REDZONE 1024 /* make this a multiple of 1024 */
67 /* XXX Note that this assumes sizeof(long) == 4 */
68 #define LWP_CHECKMARK 0x5a5a5a5aL
70 #define SIGNALS sigmask(SIGALRM)
73 typedef double stkalign_t;
80 /* internal routines */
81 void lwpAddTail _PROTO((struct lwpQueue *, struct lwpProc *));
82 struct lwpProc *lwpGetFirst _PROTO((struct lwpQueue *));
83 void lwpReschedule _PROTO((void));
84 void lwpReady _PROTO((struct lwpProc *));
85 void lwpOnalarm _PROTO((void));
88 void lwpInitContext _PROTO((struct lwpProc *, stack_t *));
89 #else /* GETCONTEXT */
91 void lwpInitContext _PROTO((struct lwpProc *, void *));
94 void lwpInitContext _PROTO((volatile struct lwpProc *volatile, void *));
96 void lwpInitContext _PROTO((struct lwpProc *, void *));
99 #endif /* GETCONTEXT */
100 void lwpEntryPoint _PROTO((void));
101 void lwpInitSelect _PROTO((struct lwpProc *self));
102 void lwpDestroy _PROTO((struct lwpProc *proc));