File:  [UNIX Amiga Emulator] / uae / src / md-i386-linux / penguin.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:39:18 2018 UTC (8 years, 3 months ago) by root
Branches: MAIN, BSchmidt
CVS tags: uae068, HEAD
uae-0.6.8

 /*
  * UAE - The Un*x Amiga Emulator
  * 
  * "SSSSSYYYMMMETTTTTRIICCC MMMMMMULTIIIIIII PPPPPPENGGGGUIIIIN!!!!!"
  *   -- David S. Miller
  * 
  * Symmetric Multi Penguin support - of course this also works on single
  * penguin machines, but it's kind of pointless there.
  * 
  * This is a rough, simpleminded draft - expect changes when it gets ported 
  * to other systems, and/or rewritten by someone who has experience with this
  * kind of thing. This is just to get started and to see how this works out.
  * 
  * We currently use only some simple system calls. You won't need special
  * thread libraries for this.
  * 
  * Copyright 1997 Bernd Schmidt
  */

#ifdef SUPPORT_PENGUINS
/* We use normal pipes for communication. These are also abused as a kind
 * of cheapo semaphores - I don't like SYSV semaphores because they don't
 * go away when the program exits - and that's [insert your favourite curse]
 * (yes of course you can clean up behind you, but what if someone SIGKILLs
 * you?)
 */
typedef int smp_comm_pipe[2];

static __inline__ void init_comm_pipe (smp_comm_pipe *p)
{
    pipe (*p);
}

static __inline__ void write_comm_pipe_int (smp_comm_pipe *p, int data)
{
    write((*p)[1], &data, sizeof (int));
}

static __inline__ int read_comm_pipe_int_blocking (smp_comm_pipe *p)
{
    int data;
    for (;;) {
	if (read ((*p)[0], &data, sizeof (int)) == sizeof (int))
	    return data;
	/* Should never get here. */
    }
}

typedef int penguin_id;
#define BAD_PENGUIN -1
extern penguin_id start_penguin (void (*f) (void));
#endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.