| 1342 | } |
| 1343 | |
| 1344 | U32 KThread::sleep(U32 ms) { |
| 1345 | if (ms <= NUMBER_OF_MILLIES_TO_SPIN_FOR_WAIT) { |
| 1346 | return Platform::nanoSleep(((U64)ms) * 1000000l); |
| 1347 | } |
| 1348 | while (true) { |
| 1349 | if (!this->condStartWaitTime) { |
| 1350 | this->condStartWaitTime = KSystem::getMilliesSinceStart(); |
| 1351 | } else { |
| 1352 | U32 diff = KSystem::getMilliesSinceStart()-this->condStartWaitTime; |
| 1353 | if (diff>ms) { |
| 1354 | this->condStartWaitTime = 0; |
| 1355 | return 0; |
| 1356 | } |
| 1357 | ms-=diff; |
| 1358 | } |
| 1359 | |
| 1360 | { |
| 1361 | BOXEDWINE_CRITICAL_SECTION_WITH_CONDITION(this->sleepCond); |
| 1362 | BOXEDWINE_CONDITION_WAIT_TIMEOUT(this->sleepCond, ms); |
| 1363 | } |
| 1364 | #ifdef BOXEDWINE_MULTI_THREADED |
| 1365 | if (this->terminating) { |
| 1366 | return -K_EINTR; |
| 1367 | } |
| 1368 | if (KThread::currentThread()->startSignal) { |
| 1369 | KThread::currentThread()->startSignal = false; |
| 1370 | return -K_CONTINUE; |
| 1371 | } |
| 1372 | #endif |
| 1373 | } |
| 1374 | } |
| 1375 | |
| 1376 | U32 KThread::sigprocmask(U32 how, U32 set, U32 oset, U32 sigsetSize) { |
| 1377 | if (oset!=0) { |
no outgoing calls
no test coverage detected