MCPcopy Create free account
hub / github.com/sql-js/sql.js / _usleep

Function _usleep

js/sql-debug.js:5144–5161  ·  view source on GitHub ↗
(useconds)

Source from the content-addressed store, hash-verified

5142
5143
5144 function _usleep(useconds) {
5145 // int usleep(useconds_t useconds);
5146 // http://pubs.opengroup.org/onlinepubs/000095399/functions/usleep.html
5147 // We're single-threaded, so use a busy loop. Super-ugly.
5148 var msec = useconds / 1000;
5149 if ((ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) && self['performance'] && self['performance']['now']) {
5150 var start = self['performance']['now']();
5151 while (self['performance']['now']() - start < msec) {
5152 // Do nothing.
5153 }
5154 } else {
5155 var start = Date.now();
5156 while (Date.now() - start < msec) {
5157 // Do nothing.
5158 }
5159 }
5160 return 0;
5161 }
5162 Module["_usleep"] = _usleep;function _nanosleep(rqtp, rmtp) {
5163 // int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
5164 var seconds = HEAP32[((rqtp)>>2)];

Callers 1

_nanosleepFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…