} \
} while (0)
+#define MMRADIO_GFREEIF(x) \
+do { \
+ if (x) { \
+ g_free(x); \
+ x = NULL; \
+ } \
+} while (0)
+
#define MMRADIO_CHECK_INSTANCE(x_radio) \
do { \
if (!x_radio) { \
} \
} while (0)
+#define MMRADIO_CHECK_ARG_RETURN_VOID(x_radio) \
+do { \
+ if (!x_radio) { \
+ MMRADIO_LOG_ERROR("argument is NULL\n"); \
+ return; \
+ } \
+} while (0)
+
#define MMRADIO_CHECK_DEVICE_STATE(x_radio) \
do { \
if (x_radio->radio_fd < 0) { \
#define MMRADIO_VOLUME_LOCK(x_radio) pthread_mutex_lock(&((mm_radio_t *)x_radio)->volume_lock)
#define MMRADIO_VOLUME_UNLOCK(x_radio) pthread_mutex_unlock(&((mm_radio_t *)x_radio)->volume_lock)
-/* seek thread */
-#define MMRADIO_SEEK_THREAD_LOCK(x_radio) pthread_mutex_lock(&((mm_radio_t *)x_radio)->seek.mutex)
-#define MMRADIO_SEEK_THREAD_UNLOCK(x_radio) pthread_mutex_unlock(&((mm_radio_t *)x_radio)->seek.mutex)
-#define MMRADIO_SEEK_THREAD_WAIT(x_radio) pthread_cond_wait(&((mm_radio_t *)x_radio)->seek.cond, &((mm_radio_t *)x_radio)->seek.mutex)
-#define MMRADIO_SEEK_THREAD_SIGNAL(x_radio) pthread_cond_signal(&((mm_radio_t *)x_radio)->seek.cond)
-
-/* scan thread */
-#define MMRADIO_SCAN_THREAD_LOCK(x_radio) pthread_mutex_lock(&((mm_radio_t *)x_radio)->scan.mutex)
-#define MMRADIO_SCAN_THREAD_UNLOCK(x_radio) pthread_mutex_unlock(&((mm_radio_t *)x_radio)->scan.mutex)
-#define MMRADIO_SCAN_THREAD_WAIT(x_radio) pthread_cond_wait(&((mm_radio_t *)x_radio)->scan.cond, &((mm_radio_t *)x_radio)->scan.mutex)
-#define MMRADIO_SCAN_THREAD_SIGNAL(x_radio) pthread_cond_signal(&((mm_radio_t *)x_radio)->scan.cond)
+/* msg/seek/scan thread */
+#define MMRADIO_THREAD_LOCK(x_thread_t) pthread_mutex_lock(&x_thread_t->mutex)
+#define MMRADIO_THREAD_UNLOCK(x_thread_t) pthread_mutex_unlock(&x_thread_t->mutex)
+#define MMRADIO_THREAD_WAIT(x_thread_t) pthread_cond_wait(&x_thread_t->cond, &x_thread_t->mutex)
+#define MMRADIO_THREAD_SIGNAL(x_thread_t) pthread_cond_signal(&x_thread_t->cond)
/* hal seek thread */
#define MMRADIO_HAL_SEEK_THREAD_LOCK(x_radio) pthread_mutex_lock(&((mm_radio_t *)x_radio)->hal_seek_mutex)