3 ms·
One way to solve the problem is to have read return a buffer instead of providing the buffer, so that the internal read multiplexing code can do the buffer-pool
by pierrebai 10y ago
One way to solve the problem is to have read return a buffer instead of providing the buffer, so that the internal read multiplexing code can do the buffer-pool trick under the hood. As long as all your readers ask for the same maximum size for the read, the pool can be shared. Under the hood, the implementation makes a select and request a buffer from the pool of the requested size.