bool TimeoutCancellationHandler::isCancelled ()
{
   qword dif_time = nanoClock() - _currentTime;
   if (_mseconds > 0 && nanoHowManySeconds(dif_time) * 1000 > _mseconds)
   {
      ArrayOutput mes_out(_message);
      mes_out.printf("The operation timed out: %d ms", _mseconds);
      mes_out.writeChar(0);
      return true;
   }
   return false;
}
void TimeoutCancellationHandler::reset (int mseconds)
{
   _mseconds = mseconds;
   _currentTime = nanoClock();
}
예제 #3
0
 bool MCSProgressCallbackTimeout(const MCSProgressData& stat, const MCSParameters &params, void* userData) {
     unsigned long long* t0 = (unsigned long long*)userData;
     unsigned long long  t  = nanoClock();
     return t - *t0 <= params.Timeout*1000000ULL;
 }