Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis12-cl/src/compiler/c-target/fragments/par-run.in
ViewVC logotype

Diff of /branches/vis12-cl/src/compiler/c-target/fragments/par-run.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3225, Thu Jul 23 11:25:15 2015 UTC revision 3226, Thu Jul 23 11:33:34 2015 UTC
# Line 151  Line 151 
151  //! Run the Diderot program (parallel version)  //! Run the Diderot program (parallel version)
152  //! \param wrld the world-state of the Diderot program  //! \param wrld the world-state of the Diderot program
153  //! \param maxNSteps the limit on the number of super steps; 0 means unlimited  //! \param maxNSteps the limit on the number of super steps; 0 means unlimited
154  //! \return the number of steps taken.  //! \return the number of steps taken, or -1 on error.
155  uint32_t @PREFIX@Run (@PREFIX@World_t *wrld, uint32_t maxNSteps)  uint32_t @PREFIX@Run (@PREFIX@World_t *wrld, uint32_t maxNSteps)
156  {  {
157      if (wrld->stage < POST_INITIALLY) {      if (wrld->stage < POST_INITIALLY) {
158          biffMsgAdd (wrld->errors, "attempt to run uninitialized program");          biffMsgAdd (wrld->errors, "attempt to run uninitialized program\n");
159          return 0;          return -1;
160      }      }
161      wrld->stage = RUNNING;      wrld->stage = RUNNING;
162    
# Line 179  Line 179 
179          args[i].wrld = wrld;          args[i].wrld = wrld;
180          args[i].maxNSteps = maxNSteps;          args[i].maxNSteps = maxNSteps;
181          args[i].id = i;          args[i].id = i;
182          if (pthread_create (&pid, NULL, @PREFIX@Worker, (void *)&(args[i])) != 0) {          int sts = pthread_create (&pid, NULL, @PREFIX@Worker, (void *)&(args[i]));
183              fprintf (stderr, "unable to create worker thread\n");          if (sts != 0) {
184              return 0;              biffMsgAddf (wrld->errors, "unable to create worker thread; err = %d\n", sts);
185                return -1;
186          }          }
187          pthread_detach (pid);          pthread_detach (pid);
188      }      }

Legend:
Removed from v.3225  
changed lines
  Added in v.3226

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0