Changeset - 0967298f2811
[Not reviewed]
Merge default
0 1 0
Nathan Brink (binki) - 16 years ago 2009-09-13 16:06:17
ohnobinki@ohnopublishing.net
merge
1 file changed with 6 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -71,13 +71,12 @@ struct general_info {
 
  internally defined funcs's prototypes
 
*/
 
void status_report_generator(struct distrenjob **distrenjobs_head);
 
void distrenjob_remove(struct distrenjob **head, struct distrenjob *bj);
 

	
 
struct distrenjob *distrenjob_get(struct distrenjob *head, jobnum_t jobnum);
 
struct distrenjob *head; /*@TODO:declare struct with no starting data */
 

	
 
/* Global Vars, try to cut down on these */
 
jobnum_t jobnum = 0; // The next job number to create in the queue
 
int hcfjob; // Highest consecutively finished job
 
int highest_jobnum; // The job number of the most recently created job, this is used when creating new jobs
 

	
 
@@ -159,13 +158,13 @@ void finish_frame(struct distrenjob *dis
 
}
 

	
 

	
 
/**
 
   creates a structure from starting data, then calls another function to actually add that struct to the queue
 
*/
 
void queue(int type, char *name, char *submitter, char *email, int priority, int start_frame, int end_frame)
 
void prepare_distrenjob(struct frameset *head, int type, char *name, char *submitter, char *email, int priority, int start_frame, int end_frame)
 
{
 
  int counter2;
 
  int counter;
 
  
 
  struct distrenjob *distrenjob;
 

	
 
@@ -314,25 +313,26 @@ void status_report_generator(struct dist
 
}
 

	
 

	
 
/**
 
   Structure Builder: This function creates frame array based on the total number of frames to be rendered, which will then be parsed by function frame_farmer. 
 
*/
 
void add_job_to_queue(struct distrenjob *job) {
 
/** Structure Builder: This function creates frame array based on the total number of frames to be rendered, which will then be parsed by function frame_farmer. */
 
void add_job_to_queue(struct distrenjob *head, struct distrenjob *job) {
 
  struct distrenjob *prev_job = head; // create pointer to previous job
 
  struct distrenjob *current_job;     // create pointer to current_job (which job is being compared to)
 

	
 
  // iterate through linked list of jobs
 
  for(current_job = head; current_job != NULL; current_job = current_job->next){
 
    if(current_job == NULL){ // if it has reached the end of the list, add job there
 
      current_job = job;
 
      break;
 
    }
 
    else if(job->priority < current_job->priority){ // if job's priority is less than current_job's priority, insert job
 
      prev_job->next = job;                        // keep in mind 1 is the lowest priority
 
      job->next = current_job;
 
      prev_job->next = job;                        // keep in mind 1 is the highest priority given to jobs, head has a
 
      job->next = current_job;                     // priority of zero so it will always be before other jobs
 
      break;
 
    }
 

	
 
    prev_job = current_job;
 
  } /* for(current_job) */
 
}
 
@@ -553,12 +553,13 @@ int distrend_config_free(struct distrend
 
int main(int argc, char *argv[])
 
{
 

	
 
  /* @TODO: Put some arg-grabbing code here */
 

	
 
  struct distrenjob *head;
 
  head->priority = 0; // make head have the highest priority
 

	
 
  int cont;
 
  struct distrend_listenset *listenset;
 
  struct distrend_config *config;
 

	
 
  start_data(); // Starts fresh or loads data from xml dump. Should we grab the return?
0 comments (0 inline, 0 general)