Lines Matching refs:ctx
19 static void start_threads(struct run_ctx *ctx) in start_threads() argument
21 ctx->start = true; in start_threads()
24 static void stop_threads(struct run_ctx *ctx) in stop_threads() argument
26 ctx->stop = true; in stop_threads()
28 __atomic_store_n(&ctx->start, true, __ATOMIC_RELEASE); in stop_threads()
31 static int wait_for_start(struct run_ctx *ctx) in wait_for_start() argument
33 while (!__atomic_load_n(&ctx->start, __ATOMIC_ACQUIRE)) in wait_for_start()
36 return ctx->stop; in wait_for_start()
41 struct run_ctx *ctx = arg; in overwrite_timer_fn() local
52 err = wait_for_start(ctx); in overwrite_timer_fn()
56 fd = bpf_program__fd(ctx->overwrite_prog); in overwrite_timer_fn()
57 loop = ctx->loop; in overwrite_timer_fn()
62 pthread_barrier_wait(&ctx->notify); in overwrite_timer_fn()
72 pthread_barrier_wait(&ctx->notify); in overwrite_timer_fn()
80 struct run_ctx *ctx = arg; in start_timer_fn() local
91 err = wait_for_start(ctx); in start_timer_fn()
95 fd = bpf_program__fd(ctx->start_prog); in start_timer_fn()
96 loop = ctx->loop; in start_timer_fn()
108 pthread_barrier_wait(&ctx->notify); in start_timer_fn()
111 pthread_barrier_wait(&ctx->notify); in start_timer_fn()
121 struct run_ctx ctx; in test_free_timer() local
130 memset(&ctx, 0, sizeof(ctx)); in test_free_timer()
135 ctx.start_prog = prog; in test_free_timer()
140 ctx.overwrite_prog = prog; in test_free_timer()
142 pthread_barrier_init(&ctx.notify, NULL, 2); in test_free_timer()
143 ctx.loop = 10; in test_free_timer()
145 err = pthread_create(&tid[0], NULL, start_timer_fn, &ctx); in test_free_timer()
149 err = pthread_create(&tid[1], NULL, overwrite_timer_fn, &ctx); in test_free_timer()
151 stop_threads(&ctx); in test_free_timer()
155 start_threads(&ctx); in test_free_timer()