Changeset 3405
- Timestamp:
- Apr 7, 2015, 1:17:10 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/Makefile.am
r3402 r3405 83 83 test/scheduler.test \ 84 84 test/scheduler2.test \ 85 test/scheduler3.test \ 85 86 test/segment.test test/smart_ptr.test \ 86 87 test/smith_waterman.test \ -
trunk/yat/utility/Scheduler.cc
r3402 r3405 2 2 3 3 /* 4 Copyright (C) 2014 Peter Johansson4 Copyright (C) 2014, 2015 Peter Johansson 5 5 6 6 This file is part of the yat library, http://dev.thep.lu.se/yat … … 24 24 #include "Scheduler.h" 25 25 26 #include <boost/exception.hpp> 27 26 28 #include <cassert> 27 29 … … 50 52 51 53 54 void Scheduler::interrupt(void) 55 { 56 workers_.interrupt_all(); 57 } 58 59 52 60 void Scheduler::post_process(JobPtr job) 53 61 { … … 55 63 assert(running_jobs_>=0); 56 64 job->status_ = Job::completed; 65 66 // check if an error occurred 67 if (job->error_) { 68 interrupt(); 69 boost::rethrow_exception(job->error_); 70 } 71 57 72 // for convenience 58 73 const std::vector<JobPtr>& vec = job->observers_; … … 182 197 } 183 198 // action 184 (*job)(); 199 try { 200 (*job)(); 201 } 202 catch (...) { 203 job->error_ = boost::current_exception(); 204 // return job to scheduler so it can act on the error 205 completed_.push(job); 206 // exit work and go home 207 return; 208 } 185 209 // return job to scheduler 186 210 completed_.push(job); -
trunk/yat/utility/Scheduler.h
r3402 r3405 26 26 #include "Queue.h" 27 27 28 #include <boost/exception_ptr.hpp> 28 29 #include <boost/thread.hpp> 29 30 #include <boost/shared_ptr.hpp> … … 110 111 unsigned priority_; 111 112 unsigned id_; 113 boost::exception_ptr error_; 112 114 }; // end class Job 113 115 … … 127 129 void add_dependency(boost::shared_ptr<Job> job, 128 130 boost::shared_ptr<Job> prerequisite); 131 /** 132 \brief interrrupt all jobs 133 */ 134 void interrupt(void); 129 135 130 136 /**
Note: See TracChangeset
for help on using the changeset viewer.