Index: /branches/eam_branch_20080719/pswarp/src/Makefile.am
===================================================================
--- /branches/eam_branch_20080719/pswarp/src/Makefile.am	(revision 18747)
+++ /branches/eam_branch_20080719/pswarp/src/Makefile.am	(revision 18748)
@@ -17,4 +17,5 @@
 	pswarpSetMaskBits.c		\
 	pswarpTransformReadout_Opt.c	\
+	pswarpThreadLauncher.c	        \
 	pswarpVersion.c            
 
Index: /branches/eam_branch_20080719/pswarp/src/pswarp.c
===================================================================
--- /branches/eam_branch_20080719/pswarp/src/pswarp.c	(revision 18747)
+++ /branches/eam_branch_20080719/pswarp/src/pswarp.c	(revision 18748)
@@ -16,4 +16,31 @@
 
     psLibInit(NULL);
+
+    // create the thread pool with 4 threads, supplying our thread launcher function
+    psThreadPoolInit (4, &pswarpThreadLauncher);
+    
+    srand48(0);
+
+    for (int i = 0; i < 10; i++) {
+	// allocate a job which takes two arguments
+	// XXX probably don't need to pre-specify the number of args
+	psThreadJob *job = psThreadJobAlloc ("THREAD_TEST", 2);
+
+	// construct the arguments for this job
+	char *arg1 = NULL;
+	char *arg2 = NULL;
+	psStringAppend (&arg1, "arg1.%d", i);
+	psStringAppend (&arg2, "arg2.%d", i);
+	psArrayAdd (job->args, 1, arg1);
+	psArrayAdd (job->args, 1, arg2);
+
+	psThreadJobAddToQueue (job);
+    }
+    if (!psThreadPoolWait ()) {
+	fprintf (stderr, "error in a threaded job\n");
+	exit (1);
+    }
+    fprintf (stderr, "success for threaded jobs\n");
+    exit (0);
 
     // model inits are needed in pmSourceIO
Index: /branches/eam_branch_20080719/pswarp/src/pswarp.h
===================================================================
--- /branches/eam_branch_20080719/pswarp/src/pswarp.h	(revision 18747)
+++ /branches/eam_branch_20080719/pswarp/src/pswarp.h	(revision 18748)
@@ -68,2 +68,4 @@
     );
 
+// thread launcher for this program
+void *pswarpThreadLauncher (void *data);
