X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=bigscreen%2Fccbs_bigscreen.cpp;h=fbbc0aaed7a06baf1640f63781dd814c19660382;hp=aa94da2913d1d2508a446485262724de3b795eb0;hb=07f65e88e6fd4ebbe8c055f3acd0385f9b64f238;hpb=22ef1e003f53437829039885c5aedf20a22423d9 diff --git a/bigscreen/ccbs_bigscreen.cpp b/bigscreen/ccbs_bigscreen.cpp index aa94da2..fbbc0aa 100644 --- a/bigscreen/ccbs_bigscreen.cpp +++ b/bigscreen/ccbs_bigscreen.cpp @@ -45,22 +45,22 @@ 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.size() > 0) { + if (screens[0]->check_invalidated()) { + screens[0]->draw(screenbuf); + } - if (screens[0]->check_invalidated()) { - screens[0]->draw(screenbuf); + memcpy(framebuf, screenbuf, 800*600*4); } - - memcpy(framebuf, screenbuf, 800*600*4); ptc_update(framebuf); - sleep(1); + conn.await_notification(0, 50000); } int main(int argc, char **argv)