| 1418 | } |
| 1419 | |
| 1420 | void TNonblockingIOThread::breakLoop(bool error) { |
| 1421 | if (error) { |
| 1422 | TOutput::instance().printf("TNonblockingServer: IO thread #%d exiting with error.", number_); |
| 1423 | // TODO: figure out something better to do here, but for now kill the |
| 1424 | // whole process. |
| 1425 | TOutput::instance().printf("TNonblockingServer: aborting process."); |
| 1426 | ::abort(); |
| 1427 | } |
| 1428 | |
| 1429 | // If we're running in the same thread, we can't use the notify(0) |
| 1430 | // mechanism to stop the thread, but happily if we're running in the |
| 1431 | // same thread, this means the thread can't be blocking in the event |
| 1432 | // loop either. |
| 1433 | if (!Thread::is_current(threadId_)) { |
| 1434 | notify(nullptr); |
| 1435 | } else { |
| 1436 | // cause the loop to stop ASAP - even if it has things to do in it |
| 1437 | event_base_loopbreak(eventBase_); |
| 1438 | } |
| 1439 | } |
| 1440 | |
| 1441 | void TNonblockingIOThread::setCurrentThreadHighPriority(bool value) { |
| 1442 | #ifdef HAVE_SCHED_H |