RE: [AD] Program hangs

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Thu, 2005-09-15 at 08:42 -0700, Robert Ohannessian wrote:
> I have a feeling that the real solution is not acquire bitmaps when
> possible (inside Allegro that is).
> 
> Surface locking, in DDraw, is used to get a pointer to some surface. If
> you don't lock it, you have no valid pointer that you can use (for
> either reading or writing).
> 
> So what are the functions in Allegro that -need- a pointer to the
> bitmap? Can they be rewritten to not use a surface pointer, but use the
> DDraw accelerated commands instead?

But then, if the user calls acquire_bitmap, wouldn't Allegro need to
un-acquire it before using those accelerated functions? It's what I
understand from a discussion about this on allegro.cc some time ago. For
after 4.2.0, don't you think we could completely get rid of
acquire_bitmap in user code?

Another problem is, under X11, no two threads may call X11 functions at
the same time, so acquire_bitmap simply does a pthreads lock there. It's
like this:

main-thread: user draws to screen
timer-thread: mouse draws to screen

Now, the timer thread has a lock around calling timer callbacks. This
lock is used when adding a new timer. So, show_mouse tries to get this
lock. At the same time, show_mouse also needs to lock the screen - but
if the user manually acquired the screen - we get the classic deadlock
by acquiring two resources.

(At least that's how I remember it, didn't actually debug this bug
report..)

-- 
Elias Pschernig





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/