home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
files
/
program
/
lynxlib
/
co.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-23
|
1KB
|
34 lines
/* This source file is part of the LynxLib miscellaneous library by
Robert Fischer, and is Copyright 1990 by Robert Fischer. It costs no
money, and you may not make money off of it, but you may redistribute
it. It comes with ABSOLUTELY NO WARRANTY. See the file LYNXLIB.DOC
for more details.
To contact the author:
Robert Fischer \\80 Killdeer Rd \\Hamden, CT 06517 USA
(203) 288-9599 fischer-robert@cs.yale.edu */
/* Coroutine C code */
#include "co.h"
BOOLEAN init_co(f, arg, stacksize, p)
/* Returns FALSE on error */
func *f; /* Cofunction to init */
LONG arg; /* Argument to that function */
long stacksize; /* Size of stack to make */
pcb *p; /* Process stack ID to put stack in */
{
/* Init the process' stack */
if ((p->stack_base = lmalloc(stacksize)) == NULL) return FALSE;
p->stack = p->stack_base + stacksize;
/* Init the process */
init_co_s(f, arg, p);
}
/* -------------------------------------------------------- */
kill_co(p) /* This kills a coroutine by freeing its stack */
pcb *p;
{
free(p->stack_base);
}
/* -------------------------------------------------------- */