Re: [AD] Allegro in a multithreaded way |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
At 12:31 PM 13/01/2005, you wrote:
I am making a game called Paintown for which you can download a demo,
http://www.ccs.neu.edu/~workmin/paintown.zip. Binary for windows. Anyway
I, as well as other people, have experienced a crash when the loading
begins becuase I am spawning two threads when the game starts. In one
thread I show a title screen and some colored letters while in the other
thread I load all the data. I know that Allegro is not multithread-safe
but I figured as long as I dont touch the screen in the thread that loads
everything I should be ok. Am I mistaken about this? The crash only occurs
on windows, I never experience any problems in Linux where it was developed.
I am using the pthreads for windows library from
http://sources.redhat.com/pthreads-win32/. I have tried to debug the
program, but the crash occurs in random places at random times so I can
only assume the bug is memory related or something of that nature.
Actually the game doesnt crash, per se, it just receives SIGTRAP such that
when the program is not run in a debugger with nothing to catch the signal
the program just crashes. If I run the program in gdb and continue past
these signals then it works fine. Also if I dont spawn the thread that
shows the title screen it works fine.
Kind of an incoherent email, but does anyone know that Allegro cannot be
used in a multithreaded way or if pthreads is just a bad library to use on
windows? Any other suggestions are welcome.
i use allegro, pthreads, and windows threads at the same time. so its OK
to be using pthreads.
allegro has many global variables, that can not be accessed by multiple
threads.
i "suggest" that you create a global lock/mutex thingy that locks any use
of allegro functions.
note: i only *suggest* this approach, its not a nice way, but its the
only way i can see it working.