Re: [AD] al_acknowledge_display_disconnected

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


On Tue, 22 May 2012 19:09:34 -0600, Trent Gamblin <trent@xxxxxxxxxx> wrote:
> 
> The Allegro event is sent first thing when the iOS event is received
> by Allegro. After that, that method, which is called from some other
> thread, waits for the display to be destroyed and then does some
> housekeeping and returns.
> 

I see.  FWIW, that's different from what I had in mind.  In my model, as
soon as the OS event is received, the ALLEGRO_DISPLAY would be turned
into a zombie or null display.  The housekeeping would be done and the
method could return immediately.  It would not wait for the user to
destroy the display first.

Can the current code suffer a deadlock like this?

1. OS calls handleScreenDisconnectNotification from some UI thread and
   waits for it to return

2. handleScreenDisconnectNotification generates an
   ALLEGRO_EVENT_DISPLAY_DISCONNECTED event and waits for the
   user program to destroy the display

3. the user program does not see the ALLEGRO_EVENT_DISPLAY_DISCONNECTED
   immediately, e.g. because there are other events earlier in the queue.
   It tries to do something with the display object, e.g. set the window
   title or resize the window.

4. (???) deadlock because the UI thread is still blocked on
   handleScreenDisconnectNotification

I don't know the iOS port so I'm just working on general principles.
Let me know if I'm way off.

Peter




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