void my_closefrom(int start);
int compute_poll_timeout(int next);
+void fd_leaving_poll(int wait_time, int status);
/* disable the specified poller */
void disable_poller(const char *poller_name);
break;
} while (1);
- clock_leaving_poll(wait_time, status);
-
- thread_harmless_end();
- thread_idle_end();
-
- if (sleeping_thread_mask & tid_bit)
- _HA_ATOMIC_AND(&sleeping_thread_mask, ~tid_bit);
+ fd_leaving_poll(wait_time, status);
/* process polled events */
break;
} while(1);
- clock_leaving_poll(wait_time, nevlist);
-
- thread_harmless_end();
- thread_idle_end();
-
- if (sleeping_thread_mask & tid_bit)
- _HA_ATOMIC_AND(&sleeping_thread_mask, ~tid_bit);
+ fd_leaving_poll(wait_time, nevlist);
if (nevlist > 0)
activity[tid].poll_io++;
break;
} while (1);
- clock_leaving_poll(wait_time, status);
-
- thread_harmless_end();
- thread_idle_end();
-
- if (sleeping_thread_mask & tid_bit)
- _HA_ATOMIC_AND(&sleeping_thread_mask, ~tid_bit);
+ fd_leaving_poll(wait_time, status);
for (count = 0; count < status; count++) {
unsigned int n = 0;
clock_entering_poll();
status = poll(poll_events, nbfd, wait_time);
clock_update_date(wait_time, status);
- clock_leaving_poll(wait_time, status);
- thread_harmless_end();
- thread_idle_end();
-
- if (sleeping_thread_mask & tid_bit)
- _HA_ATOMIC_AND(&sleeping_thread_mask, ~tid_bit);
+ fd_leaving_poll(wait_time, status);
if (status > 0)
activity[tid].poll_io++;
NULL,
&delta);
clock_update_date(delta_ms, status);
- clock_leaving_poll(delta_ms, status);
-
- thread_harmless_end();
- thread_idle_end();
-
- if (sleeping_thread_mask & tid_bit)
- _HA_ATOMIC_AND(&sleeping_thread_mask, ~tid_bit);
+ fd_leaving_poll(delta_ms, status);
if (status <= 0)
return;
return wait_time;
}
+/* Handle the return of the poller, which consists in calculating the idle
+ * time, saving a few clocks, marking the thread harmful again etc. All that
+ * is some boring stuff that all pollers have to do anyway.
+ */
+void fd_leaving_poll(int wait_time, int status)
+{
+ clock_leaving_poll(wait_time, status);
+
+ thread_harmless_end();
+ thread_idle_end();
+
+ if (sleeping_thread_mask & tid_bit)
+ _HA_ATOMIC_AND(&sleeping_thread_mask, ~tid_bit);
+}
+
/* disable the specified poller */
void disable_poller(const char *poller_name)
{