24 #include <fvwidgets/sdl_keeper.h> 26 #include <core/threading/mutex.h> 27 #include <core/threading/mutex_locker.h> 28 #include <core/exception.h> 39 unsigned int SDLKeeper::_refcount = 0;
40 Mutex SDLKeeper::_mutex;
53 SDLKeeper::SDLKeeper()
64 SDLKeeper::init(
unsigned int flags)
68 unsigned int alive_subsys = SDL_WasInit(SDL_INIT_EVERYTHING);
69 if ( (alive_subsys & flags) != flags ) {
71 if ( _refcount == 0 ) {
72 if ( SDL_Init(flags) != 0 ) {
73 throw Exception(
"SDL: initialization failed");
76 unsigned int still_to_init = ~alive_subsys & flags;
77 if ( SDL_Init(still_to_init) != 0 ) {
78 throw Exception(
"SDL: initialization failed");
92 SDLKeeper::quit() throw()
96 if ( (_refcount > 0) && (--_refcount == 0) ) {
106 SDLKeeper::force_quit()
Fawkes library namespace.
Base class for exceptions in Fawkes.
Mutex mutual exclusion lock.