From: Hugo S. <hug...@gm...> - 2001-05-10 20:08:57
|
Hi, I am looking for a small, simple library for cooperative multitaskig. It should work with Allegro (DOS) and Wattcp-32. It only needs to have two functions (se below). I found Palantir. It looks very nice but I think it is a bit oversized and since I have a diskless machine with only 1.8MB Flash disk it should be very small. Here is what I need: create_task(proc) taskswitch() It should work as follows: void task1(void) { while (!endtask) { ... Do-Something ... taskswitch(); } } void task2(void) { while (!endtask) { ... Do-Something ... taskswitch(); } } int main() { create_task(task1); create_task(task2); while (!endprg) ; } The tasks should have access to global variables, so I can do some inter-process communication. create_task starts the given function and stores it in a process list. If the function calls taskswitch it should scan the tasklist "returns" to the next task if there is one. If the function returns to create_task this can delete the function from the tasklist. The library should not affect hardware interrupt handlers as timer, printer etc. Allegros mouse, timer, keyboard, etc should be available. If anyone knows such a library or has an idea how to store the return adresses of the tast-functions, give me a hint. Thanks Thorsten |