moved screen mutex from smush into SDL backend (other backends have to make sure they are thread safe by themselves)
svn-id: r7230
This commit is contained in:
parent
7093694781
commit
feab6f904f
5 changed files with 30 additions and 17 deletions
|
@ -200,6 +200,10 @@ protected:
|
|||
// Palette data
|
||||
SDL_Color *_currentPalette;
|
||||
uint _paletteDirtyStart, _paletteDirtyEnd;
|
||||
|
||||
// Mutex that prevents multiple threads interferring with each other
|
||||
// when accessing the screen.
|
||||
SDL_mutex *_mutex;
|
||||
|
||||
|
||||
void add_dirty_rgn_auto(const byte *buf);
|
||||
|
@ -222,5 +226,15 @@ protected:
|
|||
static OSystem_SDL_Common *create();
|
||||
};
|
||||
|
||||
// Auxillary class to (un)lock a mutex on the stack
|
||||
class StackLock {
|
||||
SDL_mutex *_mutex;
|
||||
public:
|
||||
StackLock(SDL_mutex *mutex) : _mutex(mutex) { lock(); }
|
||||
~StackLock() { unlock(); }
|
||||
void lock() { SDL_mutexP(_mutex); }
|
||||
void unlock() { SDL_mutexV(_mutex); }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue