summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-01-23 12:11:49 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-01-23 12:11:49 +0100
commit6ef6490c3136141b346596d2aad81b9cb5d478e9 (patch)
tree9c91eb4674b34c0571fffbfeaec79520ce9bbcc3
parent706a6f88f46a203adfeada1f3d98262d7cc47e47 (diff)
more diagnostics for bsd
-rw-r--r--plugins.c7
-rw-r--r--threading_pthread.c16
2 files changed, 17 insertions, 6 deletions
diff --git a/plugins.c b/plugins.c
index 67323d35..d7a0dd45 100644
--- a/plugins.c
+++ b/plugins.c
@@ -43,6 +43,9 @@
#include "junklib.h"
#include "vfs.h"
+#define trace(...) { fprintf(stderr, __VA_ARGS__); }
+//#define trace(fmt,...)
+
#ifndef PATH_MAX
#define PATH_MAX 1024 /* max # of characters in a path name */
#endif
@@ -333,6 +336,9 @@ plug_quit (void) {
/////// non-api functions (plugin support)
void
plug_event_call (DB_event_t *ev) {
+ if (!mutex) {
+ trace ("plug: event passed before plugin initialization\n");
+ }
ev->time = time (NULL);
// printf ("plug_event_call enter %d\n", ev->event);
mutex_lock (mutex);
@@ -450,6 +456,7 @@ plug_load_all (void) {
fprintf (stderr, "\033[0;31mDISABLE_VERSIONCHECK=1! do not distribute!\033[0;m\n");
#endif
const char *conf_blacklist_plugins = conf_get_str ("blacklist_plugins", "");
+ trace ("plug: mutex_create\n");
mutex = mutex_create ();
const char *dirname = LIBDIR "/deadbeef";
struct dirent **namelist = NULL;
diff --git a/threading_pthread.c b/threading_pthread.c
index 83341770..29362c9d 100644
--- a/threading_pthread.c
+++ b/threading_pthread.c
@@ -58,7 +58,7 @@ uintptr_t
mutex_create (void) {
pthread_mutex_t *mtx = malloc (sizeof (pthread_mutex_t));
if (pthread_mutex_init (mtx, NULL)) {
- printf ("pthread_mutex_init failed!\n");
+ fprintf (stderr, "pthread_mutex_init failed!\n");
}
return (uintptr_t)mtx;
}
@@ -75,17 +75,21 @@ mutex_free (uintptr_t _mtx) {
int
mutex_lock (uintptr_t _mtx) {
pthread_mutex_t *mtx = (pthread_mutex_t *)_mtx;
- if (pthread_mutex_lock (mtx)) {
- printf ("pthread_mutex_lock failed\n");
+ int err = pthread_mutex_lock (mtx);
+ if (err < 0) {
+ fprintf (stderr, "pthread_mutex_lock failed (error %d)\n", err);
}
+ return err;
}
int
mutex_unlock (uintptr_t _mtx) {
pthread_mutex_t *mtx = (pthread_mutex_t *)_mtx;
- if (pthread_mutex_unlock (mtx)) {
- printf ("pthread_mutex_unlock failed\n");
- };
+ int err = pthread_mutex_unlock (mtx);
+ if (err < 0) {
+ printf ("pthread_mutex_unlock failed (error %d)\n", err);
+ }
+ return err;
}
uintptr_t