Linux: Fix a regression in 0.14.0 that caused the event loop to tick continuously, wasting CPU even when idle
Fixes #1782
This commit is contained in:
parent
93af102bec
commit
e7173f8145
@ -43,6 +43,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||||||
|
|
||||||
- macOS: Fix a rare deadlock causing kitty to hang (:iss:`1779`)
|
- macOS: Fix a rare deadlock causing kitty to hang (:iss:`1779`)
|
||||||
|
|
||||||
|
- Linux: Fix a regression in 0.14.0 that caused the event loop to tick
|
||||||
|
continuously, wasting CPU even when idle (:iss:`1782`)
|
||||||
|
|
||||||
|
|
||||||
0.14.2 [2019-06-09]
|
0.14.2 [2019-06-09]
|
||||||
---------------------
|
---------------------
|
||||||
|
|||||||
1
glfw/backend_utils.c
vendored
1
glfw/backend_utils.c
vendored
@ -278,6 +278,7 @@ int
|
|||||||
pollForEvents(EventLoopData *eld, double timeout) {
|
pollForEvents(EventLoopData *eld, double timeout) {
|
||||||
int read_ok = 0;
|
int read_ok = 0;
|
||||||
timeout = prepareForPoll(eld, timeout);
|
timeout = prepareForPoll(eld, timeout);
|
||||||
|
EVDBG("pollForEvents final timeout: %.3f", timeout);
|
||||||
int result;
|
int result;
|
||||||
double end_time = monotonic() + timeout;
|
double end_time = monotonic() + timeout;
|
||||||
|
|
||||||
|
|||||||
@ -471,8 +471,6 @@ pyset_iutf8(ChildMonitor *self, PyObject *args) {
|
|||||||
#undef INCREF_CHILD
|
#undef INCREF_CHILD
|
||||||
#undef DECREF_CHILD
|
#undef DECREF_CHILD
|
||||||
|
|
||||||
static double last_render_at = -DBL_MAX;
|
|
||||||
|
|
||||||
extern void cocoa_update_title(PyObject*);
|
extern void cocoa_update_title(PyObject*);
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@ -631,6 +629,7 @@ no_render_frame_received_recently(OSWindow *w, double now, double max_wait) {
|
|||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
render(double now) {
|
render(double now) {
|
||||||
|
static double last_render_at = -DBL_MAX;
|
||||||
double time_since_last_render = now - last_render_at;
|
double time_since_last_render = now - last_render_at;
|
||||||
if (time_since_last_render < OPT(repaint_delay)) {
|
if (time_since_last_render < OPT(repaint_delay)) {
|
||||||
set_maximum_wait(OPT(repaint_delay) - time_since_last_render);
|
set_maximum_wait(OPT(repaint_delay) - time_since_last_render);
|
||||||
@ -884,9 +883,13 @@ set_cocoa_pending_action(CocoaPendingAction action, const char *wd) {
|
|||||||
static void process_global_state(void *data);
|
static void process_global_state(void *data);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_state_check(id_type timer_id UNUSED, void *data) {
|
do_state_check(id_type timer_id UNUSED, void *data UNUSED) {
|
||||||
ChildMonitor *self = data;
|
#ifdef __APPLE__
|
||||||
process_global_state(self);
|
process_global_state(data);
|
||||||
|
#endif
|
||||||
|
// We don't actually do anything here as process_global_state
|
||||||
|
// will be called when the loop ticks on Linux
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static id_type state_check_timer = 0;
|
static id_type state_check_timer = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user