C (82/207)

From:Colin Wenzel
Date:12 Dec 99 at 03:38:41
Subject:Re: Multithreading + gfx cards

From: Colin Wenzel <colstv@hotkey.net.au>

On 12-Dec-99, Alastair M. Robinson wrote:
> My question is this: Is it legal or safe to have the window opened by
> a sub-task, but closed later by the main task, or vice-versa?

No....

I had trouble just with "Text" functions writing to the maintask's
rastport. It crashed randomly, at the finish, I simply used
my sub task to fill a buffer with the ascii then Signal() the main
task to render it...

Closing windows etc.... and I suspect a lot of Gfx & Intu functions
depend on task information to track resourses.

If the task /changes / in mid-stream, havoc breaks out.....
I have no documentary evidence to prove my theory,
only lots of experience with doing things a /different / way.

I would strongly suggest at *ALL TIMES* use the same task
to de-allocate & free resources, that originally allocated them.

A suggestion: Just use a shared variable as a pointer to
an inter-task message, or just a flag or a pair of flags,
of somesort if you want.

Use this to tell the main task what to do, from the subtask.

( do not forget to call geta4() from your subtask as soon
as it starts, before attempting to access global data. )

-------------------------------------
Colin Wenzel. Australia.

EMAIL: mailto:colstv@hotkey.net.au
URL: http://www.hotkey.net.au/~colstv/
ICQ: 17608330
MADE WITH 'AMIGA' 4000T With O.S 3.1
---------------------------------------

>
> The possible sequences of events are as follows:
>
> 1 - Main task spawns subtask. Subtask loads an image, and if
> successful, opens a window. Subtask exits. Window is closed later by
> the main task.
>
> 2 - Main task opens window, then spawns subtask. Subtask loads an
> image and closes window if unsuccessful. Subtask exits. Window is
> closed by main task.
>
> 3 - Main task opens window, then spawns subtask. Subtask loads an
> image and if unsuccessful, signals main task, which closes window.
>
> Method 1 is the easiest to retro-fit to my program, but is it safe?
>
> In the meantime, would anyone be prepared to test my program on a
> graphics card?
>
> So far I've written display code for AGA 2-8 plane, 6 & 8 plane HAM,
> LUT CyberGfx and 24-bit CyberGfx, but I don't have a graphics card,
> so can't test the CGFX code!
>
> Send me a private mail if you'd be willing to try it out for me, and
> don't mind receiving a 100k lzx archive by email.
>
> All the best,
Regards