2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

ovs-rcu: New library.

RCU allows multiple threads to read objects in parallel without any
performance penalty.  The following commit will introduce the first use.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
This commit is contained in:
Ben Pfaff
2014-03-18 16:34:28 -07:00
parent 06f64d032a
commit 0f2ea84841
7 changed files with 510 additions and 1 deletions

View File

@@ -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);