4 * Userspace RCU library checker
6 * Copyright (c) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 #include <urcu/urcu-checker.h>
28 #include <urcu/tls-compat.h>
30 #define URCU_DEBUG_STACK_LEN 10
32 struct urcu_debug_entry
{
37 struct urcu_debug_stack
{
38 struct urcu_debug_entry stack
[URCU_DEBUG_STACK_LEN
];
42 static DEFINE_URCU_TLS(struct urcu_debug_stack
, rcu_debug_stack
);
44 void rcu_read_lock_debug(void)
46 struct urcu_debug_stack
*r
= &URCU_TLS(rcu_debug_stack
);
48 r
->stack
[r
->stackend
++].ip
= __builtin_return_address(0);
51 void rcu_read_unlock_debug(void)
53 struct urcu_debug_stack
*r
= &URCU_TLS(rcu_debug_stack
);
55 assert(r
->stackend
!= 0);
56 r
->stack
[--r
->stackend
].ip
= NULL
;
59 void rcu_read_ongoing_check_debug(const char *func
)
61 struct urcu_debug_stack
*r
= &URCU_TLS(rcu_debug_stack
);
63 if (r
->stackend
== 0) {
64 fprintf(stderr
, "URCU LOCKED CHECK failure: %p\n",
65 __builtin_return_address(0));
This page took 0.038581 seconds and 5 git commands to generate.