fix(script): Make sure idle is called every iteration

This commit is contained in:
Michael Carlberg 2016-10-28 14:56:11 +02:00
parent 2cc6ef662a
commit 1e30e4254a

View File

@ -440,15 +440,21 @@ namespace modules {
CAST_MOD(Impl)->broadcast();
while (CONST_MOD(Impl).enabled()) {
std::lock_guard<threading_util::spin_lock> lck(this->m_updatelock);
CAST_MOD(Impl)->idle();
if (!CONST_MOD(Impl).enabled())
break;
std::lock_guard<threading_util::spin_lock> lck(this->m_updatelock);
{
if (!CAST_MOD(Impl)->has_event())
CAST_MOD(Impl)->idle();
continue;
else if (!CAST_MOD(Impl)->update())
CAST_MOD(Impl)->idle();
continue;
else
CAST_MOD(Impl)->broadcast();
}
}
} catch (const module_error& err) {
CAST_MOD(Impl)->halt(err.what());
} catch (const std::exception& err) {