[Pvfs2-cvs] commit by pcarns in pvfs2-1/src/io/job: job.c

CVS commit program cvs at parl.clemson.edu
Thu Jan 10 14:50:38 EST 2008


Update of /projects/cvsroot/pvfs2-1/src/io/job
In directory parlweb1:/tmp/cvs-serv11088/src/io/job

Modified Files:
	job.c 
Log Message:
the function that pushes job progress if the libary itself isn't threaded has
to be serialized if multiple application threads could call it


Index: job.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/io/job/job.c,v
diff -p -u -r1.176 -r1.177
--- job.c	11 Oct 2007 23:11:33 -0000	1.176
+++ job.c	10 Jan 2008 19:50:37 -0000	1.177
@@ -99,6 +99,7 @@ static void trove_thread_mgr_callback(vo
     PVFS_error error_code);
 static void flow_callback(flow_descriptor* flow_d);
 #ifndef __PVFS2_JOB_THREADED__
+static gen_mutex_t work_cycle_mutex = GEN_MUTEX_INITIALIZER;
 static void do_one_work_cycle_all(int idle_time_ms);
 #endif
 
@@ -4658,7 +4659,11 @@ static int completion_query_context(job_
  */
 static void do_one_work_cycle_all(int idle_time_ms)
 {
-    int total_pending_count = bmi_pending_count + bmi_unexp_pending_count
+    int total_pending_count = 0;
+    
+    gen_mutex_lock(&work_cycle_mutex);
+
+    total_pending_count = bmi_pending_count + bmi_unexp_pending_count
         + flow_pending_count + dev_unexp_pending_count + trove_pending_count;
 
     if (bmi_pending_count || bmi_unexp_pending_count || flow_pending_count)
@@ -4687,6 +4692,7 @@ static void do_one_work_cycle_all(int id
          nanosleep(&ts, NULL); 
     }
 
+    gen_mutex_unlock(&work_cycle_mutex);
     return;
 }
 #endif



More information about the Pvfs2-cvs mailing list