Changeset 3828
- Timestamp:
- Jul 23, 2019, 5:05:09 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/Makefile.am
r3827 r3828 124 124 125 125 # tests not passing through yet 126 XFAIL_TESTS = test/scheduler6.test126 XFAIL_TESTS = 127 127 128 128 DISTRIBUTED_TESTS = \ -
trunk/test/scheduler6.cc
r3827 r3828 74 74 } 75 75 76 // just to test 77 scheduler.interrupt(); 76 78 77 79 return suite.return_value(); -
trunk/yat/utility/Scheduler.cc
r3826 r3828 53 53 void Scheduler::interrupt(void) 54 54 { 55 throw_if_error(); 56 if (!job_handler_.joinable()) 57 return; 58 55 59 // first signal to JobHandler that Scheduler is waiting 56 60 boost::shared_ptr<Job> end; … … 72 76 { 73 77 throw_if_error(); 78 // if JobHandler is not joinable implies it is not executing, 79 // launch a new thread executing a JobHandler. 80 if (!job_handler_.joinable()) { 81 assert(data_.jobs().empty()); 82 /* 83 We cannot relaunch a thread, so instead we create a new thread 84 and move its guts to our member variable, job_handler_. 85 In c++11 we could do: 86 job_handler_ = boost::thread(JobHandler(data_)); 87 but in c++98 we instead use swap 88 */ 89 JobHandler tmp_handler(data_); 90 boost::thread tmp(tmp_handler); 91 swap(tmp, job_handler_); 92 } 74 93 data_.jobs().push(job); 75 94 } … … 99 118 void Scheduler::wait(void) 100 119 { 120 throw_if_error(); 121 if (!job_handler_.joinable()) 122 return; 123 101 124 // first signal to JobHandler that Scheduler is waiting 102 125 boost::shared_ptr<Job> end; -
trunk/yat/utility/Scheduler.h
r3826 r3828 75 75 be accomplished by calling wait() or interrupt(). 76 76 77 \note Currently, the Scheduler cannot be recycled, i.e.,78 if wait(void) or interruped(void) ha vebeen called, the behaviour of79 submit() is undefined.77 \note Prior version 0.17 the Scheduler could not be recycled, i.e., 78 if wait(void) or interruped(void) had been called, the behaviour of 79 submit() was undefined. 80 80 81 81 \since New in yat 0.13
Note: See TracChangeset
for help on using the changeset viewer.