In asynchronous networking code, it would be very helpful to have a notification when packet was returned to the packet pool, and in turn it becomes possible to allocate packet from that pool, without blocking.
There are similar notifications on sockets.
I'm willing to develop the code and submit PR, but I'd like to agree on the design.
In my opinion there are at least these 2 paths:
- add callback function and parameter to NX_PACKET_POOL structure
- add linked list with callback functions and parameters to NX_PACKET_POOL structure
I vote for option 2, because there can be many clients interested in allocating packets from the same pool.
PS: I know I can spawn multiple threads and block on packet allocation, but I'm writing async code and this approach is not usable for me.
In asynchronous networking code, it would be very helpful to have a notification when packet was returned to the packet pool, and in turn it becomes possible to allocate packet from that pool, without blocking.
There are similar notifications on sockets.
I'm willing to develop the code and submit PR, but I'd like to agree on the design.
In my opinion there are at least these 2 paths:
I vote for option 2, because there can be many clients interested in allocating packets from the same pool.
PS: I know I can spawn multiple threads and block on packet allocation, but I'm writing async code and this approach is not usable for me.