}
}
-static int sync_poll_loop()
-{
- int stop = 0;
-
- if (THREAD_NO_SYNC())
- return stop;
-
- THREAD_ENTER_SYNC();
-
- if (!THREAD_NEED_SYNC())
- goto exit;
-
- exit:
- stop = (jobs == 0); /* stop when there's nothing left to do */
- THREAD_EXIT_SYNC();
- return stop;
-}
-
/* Runs the polling loop */
static void run_poll_loop()
{
/* Check if we can expire some tasks */
next = wake_expired_tasks();
- /* the first thread requests a synchronization to exit when
- * there is no active jobs anymore */
- if (tid == 0 && jobs == 0)
- THREAD_WANT_SYNC();
+ /* stop when there's nothing left to do */
+ if (jobs == 0)
+ break;
/* expire immediately if events are pending */
exp = now_ms;
/* check for server status updates */
servers_check_for_updates();
- /* Synchronize all polling loops */
- if (sync_poll_loop())
- break;
-
activity[tid].loops++;
}
}