MCPcopy Create free account
hub / github.com/axboe/liburing / test_thread_shutdown

Function test_thread_shutdown

test/defer-taskrun.c:137–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137static int test_thread_shutdown(void)
138{
139 pthread_t t1;
140 int ret;
141 struct thread_data td;
142 struct io_uring_cqe *cqe;
143 uint64_t val = 1;
144
145 ret = io_uring_queue_init(8, &td.ring, IORING_SETUP_SINGLE_ISSUER |
146 IORING_SETUP_DEFER_TASKRUN |
147 IORING_SETUP_R_DISABLED);
148 if (ret)
149 return ret;
150
151 CHECK(io_uring_get_events(&td.ring) == -EBADFD);
152
153 td.efd = eventfd(0, 0);
154 CHECK(td.efd >= 0);
155
156 CHECK(pthread_create(&t1, NULL, thread, &td) == 0);
157 CHECK(pthread_join(t1, NULL) == 0);
158
159 CHECK(io_uring_get_events(&td.ring) == -EEXIST);
160
161 CHECK(write(td.efd, &val, sizeof(val)) == sizeof(val));
162 CHECK(io_uring_wait_cqe(&td.ring, &cqe) == -EEXIST);
163
164 close(td.efd);
165 io_uring_queue_exit(&td.ring);
166 return 0;
167}
168
169static int test_exec(const char *filename)
170{

Callers 1

mainFunction · 0.85

Calls 3

io_uring_queue_initFunction · 0.85
io_uring_get_eventsFunction · 0.85
io_uring_queue_exitFunction · 0.85

Tested by

no test coverage detected