Browse Source

sleep_for instead of yield reduces the cpu load.

merge-requests/365/head
eidheim 11 years ago
parent
commit
ef4f12469a
  1. 3
      juci/source.cc

3
juci/source.cc

@ -362,7 +362,8 @@ void Source::Controller::OnOpenFile(const string &filepath) {
parse_thread=std::thread([this]() { parse_thread=std::thread([this]() {
while(true) { while(true) {
while(!parse_thread_go && !parse_thread_stop) std::this_thread::yield(); while(!parse_thread_go && !parse_thread_stop)
std::this_thread::sleep_for(std::chrono::milliseconds(10));
if(parse_thread_stop) if(parse_thread_stop)
break; break;
if(!parse_thread_mapped) { if(!parse_thread_mapped) {

Loading…
Cancel
Save