! run this task */
| 40 | |
| 41 | /*! run this task */ |
| 42 | void TaskScheduler::Task::run_internal (Thread& thread) // FIXME: avoid as many dll_exports as possible |
| 43 | { |
| 44 | /* try to run if not already stolen */ |
| 45 | if (try_switch_state(INITIALIZED,DONE)) |
| 46 | { |
| 47 | Task* prevTask = thread.task; |
| 48 | thread.task = this; |
| 49 | try { |
| 50 | if (context->cancellingException == nullptr) |
| 51 | closure->execute(); |
| 52 | } catch (...) { |
| 53 | if (context->cancellingException == nullptr) |
| 54 | context->cancellingException = std::current_exception(); |
| 55 | } |
| 56 | thread.task = prevTask; |
| 57 | add_dependencies(-1); |
| 58 | } |
| 59 | |
| 60 | /* steal until all dependencies have completed */ |
| 61 | steal_loop(thread, |
| 62 | [&] () { return dependencies>0; }, |
| 63 | [&] () { while (thread.tasks.execute_local_internal(thread,this)); }); |
| 64 | |
| 65 | /* now signal our parent task that we are finished */ |
| 66 | if (parent) |
| 67 | parent->add_dependencies(-1); |
| 68 | } |
| 69 | |
| 70 | /*! run this task */ |
| 71 | dll_export void TaskScheduler::Task::run (Thread& thread) { |
no test coverage detected