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

Function thread_main

examples/proxy.c:2291–2321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2289}
2290
2291static void *thread_main(void *data)
2292{
2293 struct conn *c = data;
2294 int ret;
2295
2296 c->flags |= CONN_F_STARTED;
2297
2298 /* we need a max of 4 descriptors for each client */
2299 ret = init_ring(&c->ring, 4);
2300 if (ret)
2301 goto done;
2302
2303 if (setup_buffer_rings(&c->ring, c))
2304 goto done;
2305
2306 /*
2307 * If we're using fixed files, then we need to wait for the parent
2308 * to install the c->in_fd into our direct descriptor table. When
2309 * that happens, we'll set things up. If we're not using fixed files,
2310 * we can set up the receive or connect now.
2311 */
2312 if (!fixed_files)
2313 open_socket(c);
2314
2315 /* we're ready */
2316 pthread_barrier_wait(&c->startup_barrier);
2317
2318 __event_loop(&c->ring, c);
2319done:
2320 return NULL;
2321}
2322
2323static void usage(const char *name)
2324{

Callers

nothing calls this directly

Calls 4

init_ringFunction · 0.85
setup_buffer_ringsFunction · 0.85
open_socketFunction · 0.85
__event_loopFunction · 0.85

Tested by

no test coverage detected