aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--e-util/e-msgport.c13
-rw-r--r--e-util/e-msgport.h2
2 files changed, 9 insertions, 6 deletions
diff --git a/e-util/e-msgport.c b/e-util/e-msgport.c
index 107b889635..ab791f3262 100644
--- a/e-util/e-msgport.c
+++ b/e-util/e-msgport.c
@@ -13,6 +13,9 @@
#include <pthread.h>
+#define m(x) /* msgport debug */
+#define t(x) /* thread debug */
+
void e_dlist_init(EDList *v)
{
v->head = (EDListNode *)&v->tail;
@@ -109,8 +112,6 @@ struct _EMsgPort {
GMutex *lock;
};
-#define m(x)
-
EMsgPort *e_msgport_new(void)
{
EMsgPort *mp;
@@ -290,7 +291,7 @@ void e_thread_destroy(EThread *e)
pthread_join(id, 0);
pthread_mutex_lock(&e->mutex);
} else {
- printf("thread still active, waiting for it to finish\n");
+ (printf("thread still active, waiting for it to finish\n"));
pthread_mutex_unlock(&e->mutex);
sleep(1);
pthread_mutex_lock(&e->mutex);
@@ -301,7 +302,7 @@ void e_thread_destroy(EThread *e)
break;
case E_THREAD_NEW:
while (g_list_length(e->id_list) && tries < 5) {
- printf("thread(s) still active, waiting for them to finish\n");
+ (printf("thread(s) still active, waiting for them to finish\n"));
pthread_mutex_unlock(&e->mutex);
sleep(1);
pthread_mutex_lock(&e->mutex);
@@ -419,7 +420,7 @@ thread_dispatch(void *din)
EThread *e = din;
EMsg *m;
- printf("dispatch thread started: %ld\n", pthread_self());
+ t(printf("dispatch thread started: %ld\n", pthread_self()));
while (1) {
pthread_mutex_lock(&e->mutex);
@@ -445,7 +446,7 @@ thread_dispatch(void *din)
}
pthread_mutex_unlock(&e->mutex);
- printf("got message in dispatch thread\n");
+ t(printf("got message in dispatch thread\n"));
/* process it */
thread_received_msg(e, m);
diff --git a/e-util/e-msgport.h b/e-util/e-msgport.h
index c8cede5361..6e25235bbd 100644
--- a/e-util/e-msgport.h
+++ b/e-util/e-msgport.h
@@ -14,6 +14,8 @@ typedef struct _EDList {
struct _EDListNode *tailpred;
} EDList;
+#define E_DLIST_INITIALISER(l) { (EDListNode *)&l.tail, 0, (EDListNode *)&l.head }
+
void e_dlist_init(EDList *v);
EDListNode *e_dlist_addhead(EDList *l, EDListNode *n);
EDListNode *e_dlist_addtail(EDList *l, EDListNode *n);