bool client_idle_wait(struct client *client, unsigned flags) { assert(!client->idle_waiting); client->idle_waiting = true; client->idle_subscriptions = flags; if (client->idle_flags & client->idle_subscriptions) { client_idle_notify(client); return true; } else return false; }
void client_idle_add(struct client *client, unsigned flags) { if (client_is_expired(client)) return; client->idle_flags |= flags; if (client->idle_waiting && (client->idle_flags & client->idle_subscriptions)) { client_idle_notify(client); client_write_output(client); } }
static void client_idle_callback(gpointer data, gpointer user_data) { struct client *client = data; unsigned flags = GPOINTER_TO_UINT(user_data); if (client_is_expired(client)) return; client->idle_flags |= flags; if (client->idle_waiting && (client->idle_flags & client->idle_subscriptions)) { client_idle_notify(client); client_write_output(client); } }