1 #ifndef	_THREADS_H_
2 #define	_THREADS_H_
3 
4 #include <SDL_error.h>
5 #include <SDL_mutex.h>
6 
7 #define CHECK_AND_LOCK_MUTEX(mutex)	\
8 do	\
9 {	\
10 	if (SDL_LockMutex(mutex) != 0)	\
11 	{	\
12 		fprintf(stderr, "Lock error '%s' at file '%s' in funcion '%s' line %d\n",	\
13 			SDL_GetError(), __FILE__, __FUNCTION__, __LINE__);	\
14 	}	\
15 }	\
16 while (0)
17 
18 #define CHECK_AND_UNLOCK_MUTEX(mutex)	\
19 do	\
20 {	\
21 	if (SDL_UnlockMutex(mutex) != 0)	\
22 	{	\
23 		fprintf(stderr, "Unlock error '%s' at file '%s' in funcion '%s' line %d\n",	\
24 			SDL_GetError(), __FILE__, __FUNCTION__, __LINE__);	\
25 	}	\
26 }	\
27 while (0)
28 
29 #endif	// _THREADS_H_
30 
31