diff 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
line wrap: on
line diff
--- a/src/xmms-sid.h	Tue Feb 20 20:48:01 2007 +0000
+++ b/src/xmms-sid.h	Tue Feb 20 22:03:01 2007 +0000
@@ -53,8 +53,6 @@
 #endif
 
 
-#include <xmms/plugin.h>
-
 /*
  * Some constants and defines
  */
@@ -120,17 +118,31 @@
 /* Macros for mutexes and threads. These exist to be able to
  * easily change from pthreads to glib threads, etc, if necessary.
  */
-#define XS_MPP(M)	M ## _mutex
-#if XS_MUTEX_DEBUG
-#define XS_MUTEX(M)		pthread_mutex_t	XS_MPP(M) = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; int M ## _qq;
-#define XS_MUTEX_H(M)		extern pthread_mutex_t XS_MPP(M); extern int M ## _qq
-#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); }
-#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); }
+#ifdef AUDACIOUS_PLUGIN
+#  define XS_THREAD_T		GThread *
+#  define XS_THREAD_EXIT(M)	g_thread_exit(M)
+#  define XS_THREAD_JOIN(M)	g_thread_join(M)
+#  define XS_MPP(M)		M ## _mutex
+#  define XS_MUTEX(M)		GStaticMutex	XS_MPP(M) = G_STATIC_MUTEX_INIT
+#  define XS_MUTEX_H(M)		extern GstaticMutex XS_MPP(M)
+#  define XS_MUTEX_LOCK(M)	g_static_mutex_lock(&XS_MPP(M))
+#  define XS_MUTEX_UNLOCK(M)	g_static_mutex_unlock(&XS_MPP(M))
 #else
-#define XS_MUTEX(M)		pthread_mutex_t	XS_MPP(M) = PTHREAD_MUTEX_INITIALIZER
-#define XS_MUTEX_H(M)		extern pthread_mutex_t XS_MPP(M)
-#define XS_MUTEX_LOCK(M)	pthread_mutex_lock(&XS_MPP(M))
-#define XS_MUTEX_UNLOCK(M)	pthread_mutex_unlock(&XS_MPP(M))
+#  define XS_THREAD_T		pthread_t
+#  define XS_THREAD_EXIT(M)	pthread_exit(M)
+#  define XS_THREAD_JOIN(M)	pthread_join(M, NULL)
+#  define XS_MPP(M)		M ## _mutex
+#  if XS_MUTEX_DEBUG
+#    define XS_MUTEX(M)		pthread_mutex_t	XS_MPP(M) = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; int M ## _qq;
+#    define XS_MUTEX_H(M)		extern pthread_mutex_t XS_MPP(M); extern int M ## _qq
+#    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); }
+#    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); }
+#  else
+#    define XS_MUTEX(M)		pthread_mutex_t	XS_MPP(M) = PTHREAD_MUTEX_INITIALIZER
+#    define XS_MUTEX_H(M)		extern pthread_mutex_t XS_MPP(M)
+#    define XS_MUTEX_LOCK(M)	pthread_mutex_lock(&XS_MPP(M))
+#    define XS_MUTEX_UNLOCK(M)	pthread_mutex_unlock(&XS_MPP(M))
+#  endif
 #endif
 
 /* Shorthands for linked lists
@@ -200,11 +212,11 @@
 #ifndef DEBUG_NP
 void	XSDEBUG(const char *, ...);
 #else
-#ifdef DEBUG
-#define XSDEBUG(...) { fprintf(stderr, "XS[%s:%s:%d]: ", __FILE__, __FUNCTION__, (int) __LINE__); fprintf(stderr, __VA_ARGS__); }
-#else
-#define XSDEBUG(...) /* stub */
-#endif
+#  ifdef DEBUG
+#    define XSDEBUG(...) { fprintf(stderr, "XS[%s:%s:%d]: ", __FILE__, __FUNCTION__, (int) __LINE__); fprintf(stderr, __VA_ARGS__); }
+#  else
+#    define XSDEBUG(...) /* stub */
+#  endif
 #endif
 
 #ifdef __cplusplus