[comp.sys.amiga.tech] Need help with CreateTask under Lattice

gregg@cbnewsc.ATT.COM (gregg.g.wonderly) (01/08/90)

I am trying to parallelize some I/O intensive code (device to device
I/O) by using separate tasks to do the I/O.  I thought it should be
trival to just put the __saveds modifier on the destination function
for the new task and launch it (after the appropriate set up).
However, I run into problems on the first function call out of the new
tasks startup function.  This leads me to believe that not everything
is sane with the stack and data pointers.  Looking at the regs with CPR
indicates that a7 is well within the stack area that I allocated, and
that a4 is in fact loaded with a new value.  Can someone point me at
some example code or send me something that demonstrates the necessary
setup?

Thanks!

-- 
-----
gregg.g.wonderly@att.com   (AT&T bell laboratories)

cmcmanis@stpeter.Sun.COM (Chuck McManis) (01/13/90)

In article <12631@cbnewsc.ATT.COM> (gregg.g.wonderly) writes:
>I am trying to parallelize some I/O intensive code (device to device
>I/O) by using separate tasks to do the I/O.  I thought it should be
>trival to just put the __saveds modifier on the destination function
>for the new task and launch it (after the appropriate set up).
>However, I run into problems on the first function call out of the new
>tasks startup function.  This leads me to believe that not everything
>is sane with the stack and data pointers.

The key thing to remember with Tasks is _NO DOS CALLS_ are allowed. That
means generally anything in the C library that does I/O or calls to things
like Delay(). If you want to do DOS calls you will have to make Processes
instead of Tasks. Also you need to make sure you don't get stack checking
code in your procedure header but I think that the __saveds keyword does
this for you. Next question, how did you set up the task? Did you use
CreateTask() in amiga.lib ? Or did you roll your own ? Note that CT in 
Amiga.lib will Add your task for you automatically. Don't re add it or 
you will find yourself multithreading with the same stack, a nasty situation.


 
--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@Eng.Sun.COM
These opinions are my own and no one elses, but you knew that didn't you.
"If it didn't have bones in it, it wouldn't be crunchy now would it?!"