[PVFS2-CVS] commit by pcarns in pvfs2/src/io/job: job.c job.h
CVS commit program
cvs at parl.clemson.edu
Thu Jul 15 13:57:52 EDT 2004
Update of /projects/cvsroot/pvfs2/src/io/job
In directory parlweb:/tmp/cvs-serv761/src/io/job
Modified Files:
job.c job.h
Log Message:
added job function that lets the caller reset the timeout on a previously
posted job; untested
Index: job.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/job/job.c,v
diff -p -u -r1.132 -r1.133
--- job.c 13 Jul 2004 19:12:24 -0000 1.132
+++ job.c 15 Jul 2004 16:57:52 -0000 1.133
@@ -231,6 +231,52 @@ void job_close_context(job_context_id co
return;
}
+/* job_reset_timeout()
+ *
+ * resets the timeout associated with a job that has already been posted but
+ * has not yet completed
+ *
+ * returns 0 on success, -PVFS_errno on failure
+ */
+int job_reset_timout(job_id_t id, int timeout_sec)
+{
+ struct job_desc* query = NULL;
+ int ret = -1;
+
+ /* lock completion queue to make sure that a concurrent test call
+ * doesn't pull the job out from under us somehow
+ */
+ gen_mutex_lock(&completion_mutex);
+
+ query = id_gen_safe_lookup(id);
+ if(!query)
+ {
+ /* this id is not valid */
+ gen_mutex_unlock(&completion_mutex);
+ return(-PVFS_EINVAL);
+ }
+
+ if(query->type != JOB_BMI && query->type != JOB_FLOW)
+ {
+ /* trying to reset timeouts on a job that doesn't support the
+ * concept
+ */
+ gen_mutex_unlock(&completion_mutex);
+ return(-PVFS_EINVAL);
+ }
+
+ /* pull the job out of the time mgr (thereby clearing old timer) */
+ job_time_mgr_rem(query);
+
+ /* put it back into the time mgr with new value */
+ ret = job_time_mgr_add(query, timeout_sec);
+
+ gen_mutex_unlock(&completion_mutex);
+
+ return(ret);
+}
+
+
/* job_bmi_send()
*
* posts a job to send a BMI message
Index: job.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/job/job.h,v
diff -p -u -r1.44 -r1.45
--- job.h 8 Jul 2004 16:17:11 -0000 1.44
+++ job.h 15 Jul 2004 16:57:52 -0000 1.45
@@ -60,6 +60,8 @@ int job_open_context(job_context_id* con
void job_close_context(job_context_id context_id);
+int job_reset_timout(job_id_t id, int timeout_sec);
+
/******************************************************************
* job posting functions
*/
More information about the PVFS2-CVS
mailing list