]> git.sesse.net Git - ccbs/blobdiff - bigscreen/ccbs_bigscreen.cpp
Use await_notification instead of sleep(), gives us much better response time.
[ccbs] / bigscreen / ccbs_bigscreen.cpp
index aa94da2913d1d2508a446485262724de3b795eb0..dfb025f92cf72b0773a6c000b5ebee35686cbb41 100644 (file)
@@ -45,14 +45,12 @@ void main_loop(pqxx::connection &conn)
 {
        if (active_tournament.id == -1) {
                // No active tournament, sleep a second or so and exit
-               sleep(1);
+               conn.await_notification(1, 0);
                return;
        }
 
        memset(framebuf, 0, 800*600*4);
        
-       pqxx::work t(conn, "trx");
-
        if (screens[0]->check_invalidated()) {
                screens[0]->draw(screenbuf);
        }
@@ -60,7 +58,7 @@ void main_loop(pqxx::connection &conn)
        memcpy(framebuf, screenbuf, 800*600*4);
 
        ptc_update(framebuf);
-       sleep(1);
+       conn.await_notification(0, 50000);
 }
 
 int main(int argc, char **argv)