···33const Condition = std.Thread.Condition;
44const Mutex = std.Thread.Mutex;
5566+/// BytePool is a thread safe buffer. Use it by Allocating a given number of bytes, which will block
77+/// until one is available. The returned Slice structure contains a reference to a slice within the
88+/// pool. This slice will always belong to the Slice until deinit is called.
99+///
1010+/// This data structure is useful for receiving messages over-the-wire and sending to another thread
1111+/// for processing, while providing some level of backpressure on the read side. For example, we
1212+/// could be reading messages from the wire and sending into a queue for processing. We could read
1313+/// 10 messages off the connection, but the queue is blocked doing an expensive operation. We are
1414+/// still able to read until our BytePool is out of capacity.
1515+///
1616+/// For IRC, we use this because messages over the wire *could* be up to 4192 bytes, but commonly
1717+/// are less than 100. Instead of a pool of buffers each 4192, we write messages of exact length
1818+/// into this pool to more efficiently pack the memory
619pub fn BytePool(comptime size: usize) type {
720 return struct {
821 const Self = @This();