|
|
1.1 ! root 1: /* ! 2: * UAE - The Un*x Amiga Emulator ! 3: * ! 4: * "SSSSSYYYMMMETTTTTRIICCC MMMMMMULTIIIIIII PPPPPPENGGGGUIIIIN!!!!!" ! 5: * -- David S. Miller ! 6: * ! 7: * Symmetric Multi Penguin support - of course this also works on single ! 8: * penguin machines, but it's kind of pointless there. ! 9: * ! 10: * This is a rough, simpleminded draft - expect changes when it gets ported ! 11: * to other systems, and/or rewritten by someone who has experience with this ! 12: * kind of thing. This is just to get started and to see how this works out. ! 13: * ! 14: * We currently use only some simple system calls. You won't need special ! 15: * thread libraries for this. ! 16: * ! 17: * Copyright 1997 Bernd Schmidt ! 18: */ ! 19: ! 20: #ifdef SUPPORT_PENGUINS ! 21: /* We use normal pipes for communication. These are also abused as a kind ! 22: * of cheapo semaphores - I don't like SYSV semaphores because they don't ! 23: * go away when the program exits - and that's [insert your favourite curse] ! 24: * (yes of course you can clean up behind you, but what if someone SIGKILLs ! 25: * you?) ! 26: */ ! 27: typedef int smp_comm_pipe[2]; ! 28: ! 29: static __inline__ void init_comm_pipe (smp_comm_pipe *p) ! 30: { ! 31: pipe (*p); ! 32: } ! 33: ! 34: static __inline__ void write_comm_pipe_int (smp_comm_pipe *p, int data) ! 35: { ! 36: write((*p)[1], &data, sizeof (int)); ! 37: } ! 38: ! 39: static __inline__ int read_comm_pipe_int_blocking (smp_comm_pipe *p) ! 40: { ! 41: int data; ! 42: for (;;) { ! 43: if (read ((*p)[0], &data, sizeof (int)) == sizeof (int)) ! 44: return data; ! 45: /* Should never get here. */ ! 46: } ! 47: } ! 48: ! 49: typedef int penguin_id; ! 50: #define BAD_PENGUIN -1 ! 51: extern penguin_id start_penguin (void (*f) (void)); ! 52: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.