[comp.sys.amiga.tech] Help with Multitasking and Multiple Windows

ffishman@lion.waterloo.edu (Flynn D. Fishman) (08/04/89)

I have finally gotten around to cleaning up (finishing) some of my current
projects.  One program in particular has become a real pain in the...

This program opens a screen and then spawns several tasks which in turn
open windows on the new screen.  

The major problem is that the more tasks (actually process) I have running
the better chance I have of guruing (completely, no system message or 
anything just a grey screen or fire workds)

If I put forbids or permits in key locations I can reduce this problem
(If I put a forbid at the start of each process the problem goes away).  I am
currently hypothesing that some of the graphics routines I use have
some kind of contention.  But this does not make sense to me since they
all use the rastport and therefore the Layers library which should lock
when necessary.  The routines that I am using are:
    RectFill, SetRast, SetAPen, Text, Move, Draw, WritePixel.

I also notice that sometimes when I refresh my gadgets in several windows at
the same time, not all of the gadgets text is updated.

I am using Manx 3.6a. I use no special flags except +c for the main line
of the processes (so I can safely do a geta4() ) and +cd in the link stage
since I have two images.

On this same topic are there any Manx commands that should be avoided when
multitasking?  I notice that ran() sometimes returns a string of zeros when
multiple processes (with common memory) try to use it simultaneously
I also have suspicions about malloc.  Are there any Manx functions
that should not be used in a Multitasking program?


Another question.  If I have a borderless window with no Amiga gadgets and
set the NEWSIZE flag in the window, then when I call Size() I should
get a RESIZE message from Intuition.  Why don't I?
If I am lucky I will get a REFRESH message but never a RESIZE one.

--
Since I am here anyways...  I would just like to thank all those who
have posted to the net and have supplied me help in the past.  I am 
going to lose this account in about a week and do not know if I will
every have net access again (although I would really like to).
Good Bye and Thanks to all the net (even though none of you know who I am)
--
Flynn D. Fishman
ffishman @ lion @ watmath @ { ihnp4 | utzoo | A bunch more I can't remember }
The man without a signature or a home.

jesup@cbmvax.UUCP (Randell Jesup) (08/05/89)

In article <15645@watdragon.waterloo.edu> ffishman@lion.waterloo.edu (Flynn D. Fishman) writes:
>This program opens a screen and then spawns several tasks which in turn
>open windows on the new screen.  
>
>The major problem is that the more tasks (actually process) I have running
>the better chance I have of guruing (completely, no system message or 
>anything just a grey screen or fire workds)
>
>If I put forbids or permits in key locations I can reduce this problem
>(If I put a forbid at the start of each process the problem goes away).  I am
>currently hypothesing that some of the graphics routines I use have
>some kind of contention.  But this does not make sense to me since they
>all use the rastport and therefore the Layers library which should lock
>when necessary.  The routines that I am using are:
>    RectFill, SetRast, SetAPen, Text, Move, Draw, WritePixel.

	Many of those don't involve layers, just the rastport.  There is no
locking of rastports.  What you need to do is create multiple rastports refer-
ing to the same bitmap/layers.  I believe copying the entire rastport is kosher,
provided you also make new tmpras's if you have one (i.e. don't try to share
a tmpras.)  Then a SetAPen will only affect one process, not both/all.

-- 
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
Common phrase heard at Amiga Devcon '89: "It's in there!"

shadow@pawl.rpi.edu (Deven T. Corzine) (08/06/89)

On 4 Aug 89 18:36:17 GMT,
jesup@cbmvax.UUCP (Randell Jesup) said:

Randell>        Many of those don't involve layers, just the rastport.
Randell> There is no locking of rastports.  What you need to do is
Randell> create multiple rastports refering to the same bitmap/layers.
Randell> I believe copying the entire rastport is kosher, provided you
Randell> also make new tmpras's if you have one (i.e. don't try to
Randell> share a tmpras.)  Then a SetAPen will only affect one
Randell> process, not both/all.

Unless he wants to share the rastport and pen colors and whatnot...
Adding some semaphore locking would work nicely as well...

Deven
--
Deven T. Corzine        Internet:  deven@rpi.edu, shadow@pawl.rpi.edu
Snail:  2214 12th Street, Troy, NY 12180       Phone:  (518) 271-0750
Bitnet:  deven@rpitsmts, userfxb6@rpitsmts     UUCP:  uunet!rpi!deven
Simple things should be simple and complex things should be possible.