Change boundary conditions in run()
This commit is contained in:
parent
1f0e8d2181
commit
81ff86299f
@ -210,7 +210,7 @@ gboolean run(void *data)
|
|||||||
static int timeout_cnt = 0;
|
static int timeout_cnt = 0;
|
||||||
static gint64 next_timeout = 0;
|
static gint64 next_timeout = 0;
|
||||||
|
|
||||||
if (data) {
|
if (data && timeout_cnt > 0) {
|
||||||
timeout_cnt--;
|
timeout_cnt--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ gboolean run(void *data)
|
|||||||
gint64 sleep = get_sleep_time();
|
gint64 sleep = get_sleep_time();
|
||||||
gint64 timeout_at = now + sleep;
|
gint64 timeout_at = now + sleep;
|
||||||
|
|
||||||
if (sleep > 0) {
|
if (sleep >= 0) {
|
||||||
if (timeout_cnt == 0 || timeout_at < next_timeout) {
|
if (timeout_cnt == 0 || timeout_at < next_timeout) {
|
||||||
g_timeout_add(sleep/1000, run, mainloop);
|
g_timeout_add(sleep/1000, run, mainloop);
|
||||||
next_timeout = timeout_at;
|
next_timeout = timeout_at;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user