X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Ftimeval.c;h=ebbdb98439c3026b38ca2fd63dc3222a89b14a25;hb=1954e6bbcb7dabbbcee3dfc6f0363e32fde255b0;hp=74efa59f2faa0eead02bbe9eda6e45eb48d072d9;hpb=bae94bc77362b59a52c0f562e62ff96198dab9d0;p=sliver-openvswitch.git diff --git a/lib/timeval.c b/lib/timeval.c index 74efa59f2..ebbdb9843 100644 --- a/lib/timeval.c +++ b/lib/timeval.c @@ -31,6 +31,7 @@ #include "fatal-signal.h" #include "hash.h" #include "hmap.h" +#include "ovs-rcu.h" #include "ovs-thread.h" #include "signals.h" #include "seq.h" @@ -286,6 +287,12 @@ time_poll(struct pollfd *pollfds, int n_pollfds, HANDLE *handles OVS_UNUSED, time_left = timeout_when - now; } + if (!time_left) { + ovsrcu_quiesce(); + } else { + ovsrcu_quiesce_start(); + } + #ifndef _WIN32 retval = poll(pollfds, n_pollfds, time_left); if (retval < 0) { @@ -306,6 +313,10 @@ time_poll(struct pollfd *pollfds, int n_pollfds, HANDLE *handles OVS_UNUSED, } #endif + if (time_left) { + ovsrcu_quiesce_end(); + } + if (deadline <= time_msec()) { #ifndef _WIN32 fatal_signal_handler(SIGALRM); @@ -637,7 +648,12 @@ timeval_warp_cb(struct unixctl_conn *conn, timespec_add(&monotonic_clock.warp, &monotonic_clock.warp, &ts); ovs_mutex_unlock(&monotonic_clock.mutex); seq_change(timewarp_seq); - poll(NULL, 0, 10); /* give threads (eg. monitor) some chances to run */ + /* give threads (eg. monitor) some chances to run */ +#ifndef _WIN32 + poll(NULL, 0, 10); +#else + Sleep(10); +#endif unixctl_command_reply(conn, "warped"); }