thloop.c (9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e) thloop.c (72b4ca7e993e94f09bcf6d19fc385a2e8060c71f)
1/* SPDX-License-Identifier: GPL-2.0 */
2#include <pthread.h>
3#include <stdlib.h>
4#include <signal.h>
5#include <unistd.h>
6#include <linux/compiler.h>
7#include "../tests.h"
8
9static volatile sig_atomic_t done;
1/* SPDX-License-Identifier: GPL-2.0 */
2#include <pthread.h>
3#include <stdlib.h>
4#include <signal.h>
5#include <unistd.h>
6#include <linux/compiler.h>
7#include "../tests.h"
8
9static volatile sig_atomic_t done;
10static volatile unsigned count;
11
12/* We want to check this symbol in perf report */
13noinline void test_loop(void);
14
15static void sighandler(int sig __maybe_unused)
16{
17 done = 1;
18}
19
20noinline void test_loop(void)
21{
10
11/* We want to check this symbol in perf report */
12noinline void test_loop(void);
13
14static void sighandler(int sig __maybe_unused)
15{
16 done = 1;
17}
18
19noinline void test_loop(void)
20{
22 while (!done)
23 __atomic_fetch_add(&count, 1, __ATOMIC_RELAXED);
21 while (!done);
24}
25
26static void *thfunc(void *arg)
27{
28 void (*loop_fn)(void) = arg;
29
30 loop_fn();
31 return NULL;

--- 22 unchanged lines hidden ---
22}
23
24static void *thfunc(void *arg)
25{
26 void (*loop_fn)(void) = arg;
27
28 loop_fn();
29 return NULL;

--- 22 unchanged lines hidden ---