X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fpoll-loop.c;h=4eb1187013f64c8e22a5e163d5da6ee67e7e0047;hb=b2f2acd543f159ba984a00059892917933612a10;hp=97fc8068c1e8f9bf6269cb4f2ad7b3234403a137;hpb=2c06a96604516d28511fe74ebd9bf1a809834222;p=sliver-openvswitch.git diff --git a/lib/poll-loop.c b/lib/poll-loop.c index 97fc8068c..4eb118701 100644 --- a/lib/poll-loop.c +++ b/lib/poll-loop.c @@ -26,15 +26,11 @@ #include "fatal-signal.h" #include "list.h" #include "ovs-thread.h" +#include "seq.h" #include "socket-util.h" #include "timeval.h" #include "vlog.h" -#undef poll_fd_wait -#undef poll_timer_wait -#undef poll_timer_wait_until -#undef poll_immediate_wake - VLOG_DEFINE_THIS_MODULE(poll_loop); COVERAGE_DEFINE(poll_fd_wait); @@ -63,10 +59,11 @@ static struct poll_loop *poll_loop(void); * is affected. The event will need to be re-registered after poll_block() is * called if it is to persist. * - * Ordinarily the 'where' argument is supplied automatically; see poll-loop.h - * for more information. */ + * ('where' is used in debug logging. Commonly one would use poll_fd_wait() to + * automatically provide the caller's source file and line number for + * 'where'.) */ void -poll_fd_wait(int fd, short int events, const char *where) +poll_fd_wait_at(int fd, short int events, const char *where) { struct poll_loop *loop = poll_loop(); @@ -93,10 +90,11 @@ poll_fd_wait(int fd, short int events, const char *where) * is affected. The timer will need to be re-registered after poll_block() is * called if it is to persist. * - * Ordinarily the 'where' argument is supplied automatically; see poll-loop.h - * for more information. */ + * ('where' is used in debug logging. Commonly one would use poll_timer_wait() + * to automatically provide the caller's source file and line number for + * 'where'.) */ void -poll_timer_wait(long long int msec, const char *where) +poll_timer_wait_at(long long int msec, const char *where) { long long int now = time_msec(); long long int when; @@ -112,7 +110,7 @@ poll_timer_wait(long long int msec, const char *where) when = LLONG_MAX; } - poll_timer_wait_until(when, where); + poll_timer_wait_until_at(when, where); } /* Causes the following call to poll_block() to wake up when the current time, @@ -124,10 +122,11 @@ poll_timer_wait(long long int msec, const char *where) * is affected. The timer will need to be re-registered after poll_block() is * called if it is to persist. * - * Ordinarily the 'where' argument is supplied automatically; see poll-loop.h - * for more information. */ + * ('where' is used in debug logging. Commonly one would use + * poll_timer_wait_until() to automatically provide the caller's source file + * and line number for 'where'.) */ void -poll_timer_wait_until(long long int when, const char *where) +poll_timer_wait_until_at(long long int when, const char *where) { struct poll_loop *loop = poll_loop(); if (when < loop->timeout_when) { @@ -139,12 +138,13 @@ poll_timer_wait_until(long long int when, const char *where) /* Causes the following call to poll_block() to wake up immediately, without * blocking. * - * Ordinarily the 'where' argument is supplied automatically; see poll-loop.h - * for more information. */ + * ('where' is used in debug logging. Commonly one would use + * poll_immediate_wake() to automatically provide the caller's source file and + * line number for 'where'.) */ void -poll_immediate_wake(const char *where) +poll_immediate_wake_at(const char *where) { - poll_timer_wait(0, where); + poll_timer_wait_at(0, where); } /* Logs, if appropriate, that the poll loop was awakened by an event @@ -249,6 +249,8 @@ poll_block(void) /* Handle any pending signals before doing anything else. */ fatal_signal_run(); + + seq_woke(); } static void @@ -276,7 +278,7 @@ poll_loop(void) loop = pthread_getspecific(key); if (!loop) { loop = xzalloc(sizeof *loop); - pthread_setspecific(key, loop); + xpthread_setspecific(key, loop); } return loop; }