int oph_wf_list_drop(oph_job_list * job_info, int jobid) { int result; oph_job_info *item, *prev; pthread_mutex_lock(&global_flag); item = oph_find_job_in_job_list(job_info, jobid, &prev); if (!item) { pmesg(LOG_WARNING, __FILE__, __LINE__, "Error in searching data related to job %d.\n", jobid); pthread_mutex_unlock(&global_flag); return OPH_SERVER_OK; } result = oph_delete_from_job_list(job_info, item, prev); pthread_mutex_unlock(&global_flag); if (result) return OPH_SERVER_ERROR; return OPH_SERVER_OK; }
int oph_insert_into_job_list(oph_job_list * list, oph_job_info * item) { int result = OPH_JOB_LIST_OK; if (!list) return OPH_JOB_LIST_ERROR; if (oph_server_farm_size && (list->counter >= oph_server_farm_size)) { if (oph_server_queue_size && (list->counter >= oph_server_farm_size + oph_server_queue_size)) return OPH_JOB_LIST_FULL; result = OPH_JOB_LIST_FARM_FULL; } if (oph_find_job_in_job_list(list, item->wf->idjob, 0)) return OPH_JOB_LIST_EXISTING_JOB; if (list->tail) list->tail->next = item; list->tail = item; item->next = 0; struct timeval tv; gettimeofday(&tv, NULL); item->timestamp = tv.tv_sec; if (!list->head) list->head = item; list->counter++; return result; }