[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Thu, 19 Oct 2000, Angelo Mottola wrote:
> - In the bank read/write switching routine I just set the dirty flag of a
> specified line
> - In the unwrite bank routine I call release_sem() on the drawing sem.
> - The drawing thread does an acquire_sem() on the drawing sem, then updates
> dirty lines on the window and unsets the corresponding dirty line flags.
>
> I suppose this doesn't work nicely because during the update the main program
> could still call the bank writing routine, setting dirty flags, all while the
> drawing thread is still updating old lines. I've tried to prevent this, but
> without success so far. I'm sure this is for my inexperience with threads...
I think that you will have to do an 'acquire_sem' inside the bank
read/write routines to make sure that the dirty lines are not being
updated while you read/write them. Do a 'release_sem' after this is done.
That should fix the problem.
You have to think of the dirty flags and the lines as a 'critical section'
anyone that wants to change these things has to ask first. They ask by
acquiring the semaphore. That is why I ussually give my semaphores names
and descriptions that corespond to what they are protecting. It also
helps when you do a 'ps' command during a deadlock because blocked threads
will show the description of the semaphore they are blocking on (e.g., the
description of the mouse semaphore is 'waiting for view attach...')
> Also, mouse driver now reports correct number of mouse buttons; I don't
> understand why Jason made the mouse init routine to return always 2 buttons...
Because that function was broken in BeOS R4, it did not work at all on my
machine, so I just commented the line out and fixed the number at 2 until
the OS stopped being broken.
I am ussually a good commenter, but don't comment until code is pretty
solid and I am cleaning up (for an example of 'finished' code of mine look
at quat.c).
Something to look into: You said that debugging does not work properly
after the switch to a graphics mode. Maybe this is that the debug mode
for fullscreen is for. I was going to create a debug version of the
driver, that put the fullscreen be window into debug mode. I did not do
enough research to really know what the debug mode is, but my bet is that
it may help the debugger work properly.
--
The Phoenix -- The Artistic Intuition Company
Runica * Phoenix Quake * Caelius * Zen-X * Mirror Reflex * Infinite Realms