Lines Matching refs:ctx
30 struct ctx { struct
44 struct ctx* ctx = container_of(handle, struct ctx, worker_async); in worker_async_cb() argument
46 ASSERT_OK(uv_async_send(&ctx->main_async)); in worker_async_cb()
47 ctx->worker_sent++; in worker_async_cb()
48 ctx->worker_seen++; in worker_async_cb()
50 if (ctx->worker_sent >= NUM_PINGS) in worker_async_cb()
51 uv_close((uv_handle_t*) &ctx->worker_async, NULL); in worker_async_cb()
56 struct ctx* ctx = container_of(handle, struct ctx, main_async); in main_async_cb() local
58 ASSERT_OK(uv_async_send(&ctx->worker_async)); in main_async_cb()
59 ctx->main_sent++; in main_async_cb()
60 ctx->main_seen++; in main_async_cb()
62 if (ctx->main_sent >= NUM_PINGS) in main_async_cb()
63 uv_close((uv_handle_t*) &ctx->main_async, NULL); in main_async_cb()
68 struct ctx* ctx = arg; in worker() local
69 ASSERT_OK(uv_async_send(&ctx->main_async)); in worker()
70 ASSERT_OK(uv_run(&ctx->loop, UV_RUN_DEFAULT)); in worker()
71 uv_loop_close(&ctx->loop); in worker()
77 struct ctx* threads; in test_async()
78 struct ctx* ctx; in test_async() local
86 ctx = threads + i; in test_async()
87 ctx->nthreads = nthreads; in test_async()
88 ASSERT_OK(uv_loop_init(&ctx->loop)); in test_async()
89 ASSERT_OK(uv_async_init(&ctx->loop, &ctx->worker_async, worker_async_cb)); in test_async()
91 &ctx->main_async, in test_async()
93 ASSERT_OK(uv_thread_create(&ctx->thread, worker, ctx)); in test_async()
106 ctx = threads + i; in test_async()
107 ASSERT_EQ(ctx->worker_sent, NUM_PINGS); in test_async()
108 ASSERT_EQ(ctx->worker_seen, NUM_PINGS); in test_async()
109 ASSERT_EQ(ctx->main_sent, (unsigned int) NUM_PINGS); in test_async()
110 ASSERT_EQ(ctx->main_seen, (unsigned int) NUM_PINGS); in test_async()