Re: [AD] GGI patch for 3.9.21

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


George Foot wrote:

>    /* special bodge for the GFX_SAFE driver */
>    if (card == GFX_SAFE) {
>       ustrncpy(buf, allegro_error, sizeof(buf)-ucwidth(0));
>       if (set_gfx_mode(GFX_AUTODETECT, w, h, 0, 0) != 0) {
>          if (set_gfx_mode(GFX_AUTODETECT, 0, 0, 0, 0) != 0) {
>             set_color_depth(0); /* needs special code in set_color_depth? */
>             if (set_gfx_mode(GFX_AUTODETECT, 0, 0, 0, 0) != 0) {
>                set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
>                allegro_message("%s\n", get_config_text("Fatal error: unable to set GFX_SAFE"));
>                exit(1);


I'd like to interject some thoughts of mine here.  I can't seem to get exit() to work
reliably on BeOS if the program has multiple threads.  I'm not sure if its supposed to
work and I'm doing something wrong.  I couldn't find a BeAPI function that is
equivalent to Window's TerminateProcess.  So, I wrote a function that will kill all
the threads that Allegro creates in an order that won't cause a deadlock and then
kills all other threads the user may have created.  In order to make sure that this
function gets called in every place that may need an exit, like the default assert
handler and in the safe code like above I may want to add something like 
terminate_process to the system driver.  I'll try to find out if exit() is supposed
to work in multithreaded programs before I make these changes however, and if
so I'll just fix what I'm doing wrong to cause lockups.

Actually, it just occured to me that I may be able to solve this by registering an
atexit function that gets called before the allegro at exit functions.  I'll explore
that too.  I was just throwing this out here in case anyone knows how exit is supposed
to work in a program that uses posix threads, or how it works in Windows.


>             }
>          }
>       }
>       ustrcpy(allegro_error, buf);
>       return 0;
>    }




> --
> George

-- 
           Phoenix -- President of The Artistic Intuition Company
       Caelius * Mirror Reflex * Runica * X-Domain * Infinite Realms
                          http://www.io.com/~fenix



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