Reduce cpu usage with x11grab
This commit is contained in:
parent
c94d922282
commit
e3f642ac25
1 changed files with 2 additions and 0 deletions
|
|
@ -458,6 +458,7 @@ struct x11_attr_t : public display_t {
|
||||||
std::this_thread::sleep_for((next_frame - now) / 3 * 2);
|
std::this_thread::sleep_for((next_frame - now) / 3 * 2);
|
||||||
}
|
}
|
||||||
while(next_frame > now) {
|
while(next_frame > now) {
|
||||||
|
std::this_thread::sleep_for(1ns);
|
||||||
now = std::chrono::steady_clock::now();
|
now = std::chrono::steady_clock::now();
|
||||||
}
|
}
|
||||||
next_frame = now + delay;
|
next_frame = now + delay;
|
||||||
|
|
@ -566,6 +567,7 @@ struct shm_attr_t : public x11_attr_t {
|
||||||
std::this_thread::sleep_for((next_frame - now) / 3 * 2);
|
std::this_thread::sleep_for((next_frame - now) / 3 * 2);
|
||||||
}
|
}
|
||||||
while(next_frame > now) {
|
while(next_frame > now) {
|
||||||
|
std::this_thread::sleep_for(1ns);
|
||||||
now = std::chrono::steady_clock::now();
|
now = std::chrono::steady_clock::now();
|
||||||
}
|
}
|
||||||
next_frame = now + delay;
|
next_frame = now + delay;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue