From 076adeb0aa24e9bdc677435ddb6e444db58d5436 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 30 Aug 2009 12:07:04 +0000 Subject: Add method to clear all existing callbacks. Subversion-branch: /branches/opl-branch Subversion-revision: 1642 --- opl/opl_sdl.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'opl/opl_sdl.c') diff --git a/opl/opl_sdl.c b/opl/opl_sdl.c index b9d83385..ffbe6820 100644 --- a/opl/opl_sdl.c +++ b/opl/opl_sdl.c @@ -374,6 +374,13 @@ static void OPL_SDL_SetCallback(unsigned int ms, SDL_UnlockMutex(callback_queue_mutex); } +static void OPL_SDL_ClearCallbacks(void) +{ + SDL_LockMutex(callback_queue_mutex); + OPL_Queue_Clear(callback_queue); + SDL_UnlockMutex(callback_queue_mutex); +} + static void OPL_SDL_Lock(void) { SDL_LockMutex(callback_mutex); @@ -392,6 +399,7 @@ opl_driver_t opl_sdl_driver = OPL_SDL_PortRead, OPL_SDL_PortWrite, OPL_SDL_SetCallback, + OPL_SDL_ClearCallbacks, OPL_SDL_Lock, OPL_SDL_Unlock }; -- cgit v1.2.3