Permalink
Browse files

Timer, feat: support result_t in TimeoutScope::result.

  • Loading branch information...
xicilion committed Aug 4, 2018
1 parent d89e439 commit ac5a535b7d15a0475d57b7574fba87310cffaf7d
Showing with 5 additions and 2 deletions.
  1. +5 −2 fibjs/include/Timer.h
View
@@ -243,17 +243,20 @@ class TimeoutScope {
m_timer->sleep();
}
result_t result()
result_t result(result_t hr = 0)
{
m_timer->clear();
if (try_catch.HasCaught()) {
if (hr < 0 || try_catch.HasCaught()) {
if (this_fiber->m_termed) {
try_catch.Reset();
this_fiber->m_termed = false;
m_isolate->m_isolate->CancelTerminateExecution();
return CHECK_ERROR(CALL_E_TIMEOUT);
} else {
if (hr < 0)
return hr;
try_catch.ReThrow();
return CHECK_ERROR(CALL_E_JAVASCRIPT);
}

0 comments on commit ac5a535

Please sign in to comment.