C (103/207)

From:Duane McDonnell
Date:13 Dec 99 at 21:41:47
Subject:Re: Re: Multithreading + gfx cards

From: Duane McDonnell <dmcdonnell@primus.com.au>

>It appears in this particular example that I had a sort-of
>colliding Rastport problem, (to coin a phrase)
>The main task (which opened the screen & window)
>CreatProc()'ed the sub-task,
>which (via A4) had reference to the main tasks data segment,
>the main task was writing to the Rastport at regular intervals
>& when a special event occured, the sub-task would render
>Text() at a different location to the same rastport.

>It appeared that if the 2 occured simultaneously,
>or at least, a task switch occured during a Text(),
>a crash would happen.
>This happened rarely, but it did happen consistently.

Unless the RastPort has a Layer, it's not semaphore protected.
Without semaphore protection there's a veritable smorgasbord
of candidates lining up to ruin your day.

[snip]

>Not a single problem after that, so if anyone has a reasonable
>explanation as to why this would occur, I would be pleased
>to hear any *intelligent* suggestions why.

Also be weary of any graphics.library patches you may have
installed, they may not be quite as robust as ROM code when
it comes to arbitration. Rendering from a single thread is
the safest and easiest option as you've discovered, but with
some gymnastics you can do it from multiple threads.

Cheers,