[AD] Timer synchronization patch |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
The attached patch adds full-fledged synchronization to the timer code for multi-threaded platforms (Windows, Linux, Unix and QNX are done, BeOS not yet). A port has to provide 4 new methods for its system driver: AL_METHOD(void *, create_mutex, (void)); AL_METHOD(void, destroy_mutex, (void *handle)); AL_METHOD(void, lock_mutex, (void *handle)); AL_METHOD(void, unlock_mutex, (void *handle)); and #define ALLEGRO_MULTITHREADED in order to enable the code. The code essentially makes sure that a timer proc can't be unregistered (by the primary thread) while it is being executed (by the timer thread). This may currently happen with show_mouse(NULL): it calls remove_int(mouse_move); then _mouse_screen = NULL; but mouse_move() calls draw_mouse() that draws onto _mouse_screen... Tested under DOS, Windows, Linux w/ pthreads and Linux w/o pthreads. -- Eric Botcazou
Attachment:
timer_sync3.zip
Description: Zip archive
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |