X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=doc%2Fexamples%2Furcu-flavors%2Fbp.c;h=0bbc303a9946ad017d24a47fd6ee6e22e9fa158c;hb=1c87adb3dde9011cc0ac576b5ec622a7c845a06a;hp=64978fcef2f8f305e3c4f72078f99b415d98fc25;hpb=9b4bf32b5757c99226eb78bea03f911536f2e9fc;p=userspace-rcu.git diff --git a/doc/examples/urcu-flavors/bp.c b/doc/examples/urcu-flavors/bp.c index 64978fc..0bbc303 100644 --- a/doc/examples/urcu-flavors/bp.c +++ b/doc/examples/urcu-flavors/bp.c @@ -1,20 +1,6 @@ -/* - * Copyright (C) 2013 Mathieu Desnoyers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ +// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers +// +// SPDX-License-Identifier: LGPL-2.1-or-later #include #include @@ -22,7 +8,7 @@ #include #include -#include /* Bulletproof RCU flavor */ +#include /* Bulletproof RCU flavor */ #include /* List example */ #include /* For CAA_ARRAY_SIZE */ @@ -54,7 +40,7 @@ int add_node(uint64_t v) return 0; } -int main(int argc, char **argv) +int main(void) { uint64_t values[] = { 42, 36, 24, }; unsigned int i; @@ -81,7 +67,7 @@ int main(int argc, char **argv) * with rcu_read_lock() and rcu_read_unlock(). They can be * nested. Those are no-ops for the QSBR flavor. */ - rcu_read_lock(); + urcu_bp_read_lock(); /* * RCU traversal of the linked list. @@ -89,7 +75,7 @@ int main(int argc, char **argv) cds_list_for_each_entry_rcu(node, &mylist, node) { printf("Value: %" PRIu64 "\n", node->value); } - rcu_read_unlock(); + urcu_bp_read_unlock(); /* * Removing nodes from linked list. Safe against concurrent RCU @@ -104,7 +90,7 @@ int main(int argc, char **argv) * spawning any call_rcu() thread. It is slower though, * since there is no batching. */ - synchronize_rcu(); + urcu_bp_synchronize_rcu(); free(node); }