Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!m.cs.uiuc.edu!schwager From: schwager@m.cs.uiuc.edu (Michael Schwager) Newsgroups: comp.sys.amiga.programmer Subject: General questions regarding Tasks Summary: I have a few general questions about tasks Keywords: tasks help questions seeking Message-ID: <1991May24.160440.374@m.cs.uiuc.edu> Date: 24 May 91 16:04:40 GMT Organization: University of Illinois, Dept. of Comp. Sci., Urbana, IL Lines: 65 Hi, I'm looking for guidelines about using tasks within C programs. C code examples would help. I've got Aztec C 5.0d, and their little beep.c example only goes so far. For example, I wonder: Can I call other functions from within my task? What do I need to be careful of (besides changing system variables)? Also, can I pass variables to a Task, like this: CreateTask ("Name", 0, func3 (var0, var1, var2), BIGSTACK); I'm getting random (I think) address error Guru's when I try to get too fancy with Tasks. Too fancy means: I want to call another function from within it. Here's a concrete example (something I'm trying now). Given a program, source code in at least two files. The first file contains a coupla functions: ************ file 0 *********** func0 () /* main () or whatever */ { blah; } func1 (number) int number; { struct Task *myTCB; blah; myTCB = func2 (); loop: { blah; if (some_condition) DeleteTask (myTCB); } } ************ file 0 *********** The second, function(s) and a Task: ************ file 1 *********** struct Task * func2 () { struct Task *someTCB; blah; someTCB = CreateTask ("Name", 0, func3, BIGSTACK); blah; return (someTCB); } func3 () /* It's a task! */ { blah; func1 (number); /* Oooo... can I do this? Say func1() only has automagic variables. */ blah; } ************ file 1 *********** Thanks for the help. -Mike Schwager | Machine: Amiga 500, 3 MB RAM/30 HD INTERNET:schwager@cs.uiuc.edu | Bike: '83 Kawasaki KZ750 LTD UUCP:{uunet|convex|pur-ee}!uiucdcs!schwager| Band: Poi Dog Pondering // BITNET:schwager@mike.cs.uiuc.edu | Hero: Robert Bly \\ // University of Illinois, Dept. of Comp. Sci.| DoD: #0301 \X/Amiga