Changeset - 8ef16b5f6624
[Not reviewed]
default
0 1 0
LordOfWar - 16 years ago 2009-09-13 11:20:15

-adjusted parameters of functions so that the pointer to the head function has to be passed to them
-updated faulty notes
-edited main() so that it set the priority of the head distrenjob to zero
-changed queue() to prepare_distrenjob()
-deleted global \"struc distrenjob *head\" variable because it is created in main()
1 file changed with 9 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -75,7 +75,6 @@ void distrenjob_remove(struct distrenjob
 
struct distrenjob *remove_job(int jobnum_t);
 

	
 
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
 
@@ -163,11 +162,11 @@ 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;
 

	
 
  distrenjob->type = 1; /*@TODO: add type to blendjob struct*/
 
@@ -315,7 +314,7 @@ 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) {
 
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)
 

	
 
@@ -326,8 +325,8 @@ void add_job_to_queue(struct distrenjob 
 
      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;
 
    }
 

	
 
@@ -335,9 +334,9 @@ void add_job_to_queue(struct distrenjob 
 
  } // end of for statement
 
}
 

	
 
void change_job_priority(int jobnum, int new_priority){
 
void change_job_priority(struct distrenjob *head, int jobnum, int new_priority){
 
  struct distrenjob *job;
 
  job = remove_job(jobnum);
 
  job = remove_job(head, jobnum);
 
  job->priority = new_priority;
 
  add_job_to_queue(job);
 
}
 
@@ -345,7 +344,7 @@ void change_job_priority(int jobnum, int
 
/**
 
   Removes job from queue without freeing/deleting it. Meant to be temporary.
 
 */
 
struct distrenjob *remove_job(int jobnum_t)
 
struct distrenjob *remove_job(struct distrenjob *head, int jobnum_t)
 
{
 
  struct distrenjob *job;
 
  struct distrenjob *prev_job = head;
 
@@ -584,6 +583,7 @@ 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;
0 comments (0 inline, 0 general)