| 34 | |
| 35 | |
| 36 | void MainController::GlobalAsyncModuleHandler::removeAsync(Processor* p, const SafeFunctionCall::Function& removeFunction) |
| 37 | { |
| 38 | bool synchronous = p->getMainController()->isBeingDeleted() || p->getMainController()->isFlakyThreadingAllowed(); |
| 39 | |
| 40 | if (removeFunction) |
| 41 | { |
| 42 | auto f = [removeFunction](Processor* p) |
| 43 | { |
| 44 | LockHelpers::freeToGo(p->getMainController()); |
| 45 | |
| 46 | auto result = removeFunction(p); |
| 47 | |
| 48 | p->getMainController()->getGlobalAsyncModuleHandler().addPendingUIJob(p, What::Delete); |
| 49 | |
| 50 | return result; |
| 51 | }; |
| 52 | |
| 53 | if (synchronous) |
| 54 | f(p); |
| 55 | else |
| 56 | mc->getKillStateHandler().killVoicesAndCall(p, f, KillStateHandler::TargetThread::SampleLoadingThread); |
| 57 | } |
| 58 | else |
| 59 | { |
| 60 | p->getMainController()->getGlobalAsyncModuleHandler().addPendingUIJob(p, What::Delete); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | void MainController::GlobalAsyncModuleHandler::addAsync(Processor* p, const SafeFunctionCall::Function& addFunction) |
| 65 | { |
no test coverage detected