Index: trunk/Ohana/src/opihi/pantasks/pantasks.c
===================================================================
--- trunk/Ohana/src/opihi/pantasks/pantasks.c	(revision 9473)
+++ trunk/Ohana/src/opihi/pantasks/pantasks.c	(revision 11084)
@@ -10,4 +10,8 @@
 void program_init (int *argc, char **argv) {
   
+  pthread_t jobsThread;
+  pthread_t tasksThread;
+  pthread_t controllerThread;
+
   auto_break = TRUE;
 
@@ -26,6 +30,21 @@
   set_str_variable ("RCFILE", opihi_rcfile);
 
-# ifdef HELPDIR_DEFAULT
-  set_str_variable ("HELPDIR", MACRO_NAME(HELPDIR_DEFAULT));
+# ifdef DATADIR_DEFAULT
+  { 
+    char *datadir;
+    char *helpdir;
+    char *modules;
+    datadir = MACRO_NAME(DATADIR_DEFAULT);
+    /* set_str_variable ("DATADIR", datadir); */
+    ALLOCATE (helpdir, char, strlen(datadir) + strlen("/help") + 2);
+    sprintf (helpdir, "%s/help", datadir);
+    set_str_variable ("HELPDIR", helpdir);
+    free (helpdir);
+    ALLOCATE (modules, char, strlen(datadir) + strlen("/modules") + 2);
+    sprintf (modules, "%s/modules", datadir);
+    set_str_variable ("MODULES:0", modules);
+    set_int_variable ("MODULES:n", 1);
+    free (helpdir);
+  }
 # endif
 
@@ -33,4 +52,9 @@
   signal (SIGTSTP, gotsignal);
   signal (SIGTTIN, gotsignal);
+
+  /* start up the background threads here */
+  pthread_create (&tasksThread,      NULL, &CheckTasksThread, 	   NULL);
+  pthread_create (&jobsThread,       NULL, &CheckJobsThread, 	   NULL);
+  pthread_create (&controllerThread, NULL, &CheckControllerThread, NULL);
   return;
 }
@@ -61,2 +85,9 @@
   exit (status);
 }
+
+/* pantasks runs three (or four) threads:
+   - one thread parses commands from the connected clients
+   - one thread runs the scheduler loop
+   - one thread may run the controller loop independently
+   - the main thread runs readline and accepts user input
+*/
