From de531c691aee5200d31e018186f145d0eebb7814 Mon Sep 17 00:00:00 2001 From: François Revel Date: Mon, 6 Oct 2008 00:29:02 +0000 Subject: Make gui_poll() a little better. Don't check for the event pipe fd if select returned an error. svn path=/trunk/netsurf/; revision=5492 --- beos/beos_gui.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'beos/beos_gui.cpp') diff --git a/beos/beos_gui.cpp b/beos/beos_gui.cpp index 3f7f803f3..1e4af4a99 100644 --- a/beos/beos_gui.cpp +++ b/beos/beos_gui.cpp @@ -650,15 +650,18 @@ void gui_poll(bool active) bigtime_t next_schedule = earliest_callback_timeout - system_time(); + if (!block) + next_schedule = 0LL; // now + if (block && earliest_callback_timeout != B_INFINITE_TIMEOUT) + block = false; timeout.tv_sec = (long)(next_schedule / 1000000LL); timeout.tv_usec = (long)(next_schedule % 1000000LL); LOG(("gui_poll: select(%d, ..., %Ldus", max_fd, next_schedule)); fd_count = select(max_fd, &read_fd_set, &write_fd_set, &exc_fd_set, - /*block?NULL:*/( - earliest_callback_timeout == B_INFINITE_TIMEOUT) ? NULL : &timeout); + block ? NULL : &timeout); - if (max_fd > 0 && FD_ISSET(sEventPipe[0], &read_fd_set)) { + if (fd_count > 0 && FD_ISSET(sEventPipe[0], &read_fd_set)) { BMessage *message; int len = read(sEventPipe[0], &message, sizeof(void *)); LOG(("gui_poll: BMessage ? %d read", len)); -- cgit v1.2.3