Index: trunk/Ohana/src/opihi/pantasks/InputQueue.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/InputQueue.c	(revision 16449)
+++ trunk/Ohana/src/opihi/pantasks/InputQueue.c	(revision 23530)
@@ -1,3 +1,4 @@
 # include "pantasks.h"
+// we use fprintf for DEBUG statements to avoid deadlocking issues
 
 static int Ninputs = 0;
@@ -23,6 +24,8 @@
 void AddNewInput (char *input) {
 
+  // XXX define the InputMutex
   SerialThreadLock ();
-  if (DEBUG) gprint (GP_LOG, "adding a new input (%s)\n", input);
+
+  if (DEBUG) fprintf (stderr, "adding a new input (%s)\n", input);
   inputs[Ninputs] = input;
   Ninputs ++;
@@ -31,5 +34,5 @@
     REALLOCATE (inputs, char *, NINPUTS);
   }
-  if (DEBUG) gprint (GP_LOG, "done new input (%s)\n", input);
+  if (DEBUG) fprintf (stderr, "done new input (%s)\n", input);
   SerialThreadUnlock ();
 }
@@ -40,5 +43,7 @@
   int i, j;
 
-  if (DEBUG) gprint (GP_LOG, "deleting an input (%s)\n", input);
+  if (DEBUG) fprintf (stderr, "deleting an input (%s)\n", input);
+
+  // XXX lock here
   for (i = 0; i < Ninputs; i++) {
     if (inputs[i] == input) {
@@ -52,9 +57,11 @@
 	REALLOCATE (inputs, char *, NINPUTS);
       }
-      if (DEBUG) gprint (GP_LOG, "deleted an input\n");
+      // XXX unlock here
+      if (DEBUG) fprintf (stderr, "deleted an input\n");
       return TRUE;
     }
   }
   // did not find the input
+  // XXX unlock here
   return FALSE;
 }
@@ -66,12 +73,17 @@
   char *input, *line, *outline, tmp;
 
-  if (Ninputs < 1) return;
+  // XXX lock here
+  if (Ninputs < 1) {
+    // XXX unlock here
+    return;
+  }
 
   input = inputs[0];
-  if (DEBUG) gprint (GP_LOG, "got an input (%s)\n", input);
+  if (DEBUG) fprintf (stderr, "got an input (%s)\n", input);
   
   Nbytes = snprintf (&tmp, 0, "input %s", input);
   ALLOCATE (line, char, Nbytes + 1);
   snprintf (line, Nbytes + 1, "input %s", input);
+  // XXX unlock here
 
   status = command (line, &outline, TRUE);
