comparison src/xmms-sid.h @ 532:bc548249464a

Audacious glue.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 20 Feb 2007 22:03:01 +0000
parents fa95d942f226
children 9ca430524698
comparison
equal deleted inserted replaced
531:92b6496c73b5 532:bc548249464a
51 # define _(String) (String) 51 # define _(String) (String)
52 # define N_(String) (String) 52 # define N_(String) (String)
53 #endif 53 #endif
54 54
55 55
56 #include <xmms/plugin.h>
57
58 /* 56 /*
59 * Some constants and defines 57 * Some constants and defines
60 */ 58 */
61 /* #define to enable spurious debugging messages for development 59 /* #define to enable spurious debugging messages for development
62 * purposes. Output goes to stderr. See also DEBUG_NP below. 60 * purposes. Output goes to stderr. See also DEBUG_NP below.
118 116
119 117
120 /* Macros for mutexes and threads. These exist to be able to 118 /* Macros for mutexes and threads. These exist to be able to
121 * easily change from pthreads to glib threads, etc, if necessary. 119 * easily change from pthreads to glib threads, etc, if necessary.
122 */ 120 */
123 #define XS_MPP(M) M ## _mutex 121 #ifdef AUDACIOUS_PLUGIN
124 #if XS_MUTEX_DEBUG 122 # define XS_THREAD_T GThread *
125 #define XS_MUTEX(M) pthread_mutex_t XS_MPP(M) = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; int M ## _qq; 123 # define XS_THREAD_EXIT(M) g_thread_exit(M)
126 #define XS_MUTEX_H(M) extern pthread_mutex_t XS_MPP(M); extern int M ## _qq 124 # define XS_THREAD_JOIN(M) g_thread_join(M)
127 #define XS_MUTEX_LOCK(M) { M ## _qq = pthread_mutex_lock(&XS_MPP(M)); if (M ## _qq) XSDEBUG("XS_MUTEX_LOCK(" #M ") == %i\n", M ## _qq); } 125 # define XS_MPP(M) M ## _mutex
128 #define XS_MUTEX_UNLOCK(M) { M ## _qq = pthread_mutex_unlock(&XS_MPP(M)); if (M ## _qq) XSDEBUG("XS_MUTEX_UNLOCK(" #M ") == %i\n", M ## _qq); } 126 # define XS_MUTEX(M) GStaticMutex XS_MPP(M) = G_STATIC_MUTEX_INIT
127 # define XS_MUTEX_H(M) extern GstaticMutex XS_MPP(M)
128 # define XS_MUTEX_LOCK(M) g_static_mutex_lock(&XS_MPP(M))
129 # define XS_MUTEX_UNLOCK(M) g_static_mutex_unlock(&XS_MPP(M))
129 #else 130 #else
130 #define XS_MUTEX(M) pthread_mutex_t XS_MPP(M) = PTHREAD_MUTEX_INITIALIZER 131 # define XS_THREAD_T pthread_t
131 #define XS_MUTEX_H(M) extern pthread_mutex_t XS_MPP(M) 132 # define XS_THREAD_EXIT(M) pthread_exit(M)
132 #define XS_MUTEX_LOCK(M) pthread_mutex_lock(&XS_MPP(M)) 133 # define XS_THREAD_JOIN(M) pthread_join(M, NULL)
133 #define XS_MUTEX_UNLOCK(M) pthread_mutex_unlock(&XS_MPP(M)) 134 # define XS_MPP(M) M ## _mutex
135 # if XS_MUTEX_DEBUG
136 # define XS_MUTEX(M) pthread_mutex_t XS_MPP(M) = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; int M ## _qq;
137 # define XS_MUTEX_H(M) extern pthread_mutex_t XS_MPP(M); extern int M ## _qq
138 # define XS_MUTEX_LOCK(M) { M ## _qq = pthread_mutex_lock(&XS_MPP(M)); if (M ## _qq) XSDEBUG("XS_MUTEX_LOCK(" #M ") == %i\n", M ## _qq); }
139 # define XS_MUTEX_UNLOCK(M) { M ## _qq = pthread_mutex_unlock(&XS_MPP(M)); if (M ## _qq) XSDEBUG("XS_MUTEX_UNLOCK(" #M ") == %i\n", M ## _qq); }
140 # else
141 # define XS_MUTEX(M) pthread_mutex_t XS_MPP(M) = PTHREAD_MUTEX_INITIALIZER
142 # define XS_MUTEX_H(M) extern pthread_mutex_t XS_MPP(M)
143 # define XS_MUTEX_LOCK(M) pthread_mutex_lock(&XS_MPP(M))
144 # define XS_MUTEX_UNLOCK(M) pthread_mutex_unlock(&XS_MPP(M))
145 # endif
134 #endif 146 #endif
135 147
136 /* Shorthands for linked lists 148 /* Shorthands for linked lists
137 */ 149 */
138 #define LPREV (pNode->pPrev) 150 #define LPREV (pNode->pPrev)
198 /* Debugging 210 /* Debugging
199 */ 211 */
200 #ifndef DEBUG_NP 212 #ifndef DEBUG_NP
201 void XSDEBUG(const char *, ...); 213 void XSDEBUG(const char *, ...);
202 #else 214 #else
203 #ifdef DEBUG 215 # ifdef DEBUG
204 #define XSDEBUG(...) { fprintf(stderr, "XS[%s:%s:%d]: ", __FILE__, __FUNCTION__, (int) __LINE__); fprintf(stderr, __VA_ARGS__); } 216 # define XSDEBUG(...) { fprintf(stderr, "XS[%s:%s:%d]: ", __FILE__, __FUNCTION__, (int) __LINE__); fprintf(stderr, __VA_ARGS__); }
205 #else 217 # else
206 #define XSDEBUG(...) /* stub */ 218 # define XSDEBUG(...) /* stub */
207 #endif 219 # endif
208 #endif 220 #endif
209 221
210 #ifdef __cplusplus 222 #ifdef __cplusplus
211 } 223 }
212 #endif 224 #endif