Changeset 250 in flair-src for trunk/lib/FlairCore


Ignore:
Timestamp:
Jun 27, 2018, 11:46:53 AM (6 years ago)
Author:
Bayard Gildas
Message:

little problem with thread (improperly calculated delay for first iteration of a periodic task in some case)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/Thread_impl.cpp

    r243 r250  
    180180        }
    181181#else
    182   next_time -= period;
    183   next_time += period * 1000;
     182  if (period_set) {
     183    next_time -= period;
     184    next_time += period * 1000;
     185  } else next_time=GetTime()+period*1000;
    184186#endif
    185187  this->period = period * 1000;
     
    202204        }
    203205#else
    204   next_time -= period;
    205   next_time += period * 1000 * 1000;
     206  if (period_set) {
     207    next_time -= period;
     208    next_time += period * 1000 * 1000;
     209  } else next_time=GetTime()+period*1000*1000;
    206210#endif
    207211  this->period = period * 1000 * 1000;
     
    352356      Printf("    min latency (ns): %lld\n", min_latency);
    353357      Printf("    max latency (ns): %lld\n", max_latency);
    354       Printf("    latency moy (ns): %lld\n", mean_latency / cpt);
    355       Printf("    iterations: %lld\n", cpt);
     358      if (cpt) {
     359        Printf("    latency moy (ns): %lld\n", mean_latency / cpt);
     360        Printf("    iterations: %lld\n", cpt);
     361      }
    356362    }
    357363  }
Note: See TracChangeset for help on using the changeset viewer.