IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 25, 2009, 11:56:09 AM (17 years ago)
Author:
eugene
Message:

upgrade threading/locking model for pantasks: changes merged from eam_branch_20090322

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pantasks/JobOps.c

    r18160 r23530  
    8888  }
    8989
    90   /* check if controller is running */
    91   status = CheckControllerStatus ();
    92   if (!status) {
    93     return;
    94   }
    95 
    96   sprintf (command, "jobstack busy");
    97   InitIOBuffer (&buffer, 0x100);
    98 
    99   SerialThreadLock ();
    100   status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
    101   SerialThreadUnlock ();
    102 
    103   if (status) {
    104     gprint (GP_LOG, " jobs currently running remotely:\n");
    105     gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG);
    106   } else {
    107     gprint (GP_LOG, "controller is not responding\n");
    108   }
    109   FreeIOBuffer (&buffer);
    11090  return;
    11191}
     
    169149    REALLOCATE (jobs, Job *, NJOBS);
    170150  }
     151
     152  /* increment job counters */
     153  task[0].Npending ++;
     154
    171155  return (jobs[Njobs-1]);
    172156}
     
    265249int SubmitJob (Job *job) {
    266250
     251  int status;
     252
    267253  if (job[0].mode == JOB_LOCAL) {
    268254    if (DEBUG) fprintf (stderr, "submit job: (%zx) %d of %d\n", (size_t) job[0].stdout_buff.buffer, job[0].stdout_buff.Nbuffer, job[0].stdout_buff.Nalloc);
    269     SubmitLocalJob (job);
     255    status = SubmitLocalJob (job);
    270256  } else {
    271     SubmitControllerJob (job);
     257    status = SubmitControllerJob (job);
     258  }
     259  if (!status) {
     260    return FALSE;
    272261  }
    273262
     
    285274  if (job[0].mode == JOB_LOCAL) {
    286275    CheckLocalJob (job);
    287   } else {
    288     /* controller jobs are now checked en masse by CheckController */
    289     /* CheckControllerJob (job); */
     276    /* controller jobs are checked en masse by CheckController */
    290277  }
    291278  return (job[0].state);
Note: See TracChangeset for help on using the changeset viewer.