]>
git.proxmox.com Git - mirror_ovs.git/blob - tests/test-rcu.c
2 * Copyright (c) 2016 Nicira, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "fatal-signal.h"
21 #include "ovs-thread.h"
26 quiescer_main(void *aux OVS_UNUSED
)
28 /* A new thread must be not be quiescent */
29 ovs_assert(!ovsrcu_is_quiescent());
30 ovsrcu_quiesce_start();
31 /* After the above call it must be quiescent */
32 ovs_assert(ovsrcu_is_quiescent());
38 test_rcu_quiesce(int argc OVS_UNUSED
, char *argv
[] OVS_UNUSED
)
42 quiescer
= ovs_thread_create("quiescer", quiescer_main
, NULL
);
44 /* This is the main thread of the process. After spawning its first
45 * thread it must not be quiescent. */
46 ovs_assert(!ovsrcu_is_quiescent());
48 xpthread_join(quiescer
, NULL
);
51 OVSTEST_REGISTER("test-rcu-quiesce", test_rcu_quiesce
);