MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / SleepForMicroseconds

Method SleepForMicroseconds

tensorflow/core/platform/posix/env.cc:93–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91 }
92
93 void SleepForMicroseconds(int64 micros) override {
94 while (micros > 0) {
95 timespec sleep_time;
96 sleep_time.tv_sec = 0;
97 sleep_time.tv_nsec = 0;
98
99 if (micros >= 1e6) {
100 sleep_time.tv_sec =
101 std::min<int64>(micros / 1e6, std::numeric_limits<time_t>::max());
102 micros -= static_cast<int64>(sleep_time.tv_sec) * 1e6;
103 }
104 if (micros < 1e6) {
105 sleep_time.tv_nsec = 1000 * micros;
106 micros = 0;
107 }
108 while (nanosleep(&sleep_time, &sleep_time) != 0 && errno == EINTR) {
109 // Ignore signals and wait for the full interval to elapse.
110 }
111 }
112 }
113
114 Thread* StartThread(const ThreadOptions& thread_options, const string& name,
115 std::function<void()> fn) override {

Callers 2

CallWithRetriesMethod · 0.45
TESTFunction · 0.45

Calls 1

maxFunction · 0.50

Tested by 1

TESTFunction · 0.36