Closed ghost closed 10 months ago
Looks interesting, but I think the implementation could probably be improved a bit, unifying it with the existing poll implementation. I will have a look when I have more time.
I committed a more general version, putting the existing poll implementation(s) into a default_poll callback that you can overwrite. You can also set your own callback for a connection pool, which will then be used for all connections opened by the pool. Let me know if this works for you or if you have any other feedback.
Hello,
I think your version is fine too for general use. But it looks like "include/tao/pq/poll.hpp" is missing from the commit.
Thank you.
My bad, I forgot the git add ...
- should be fixed now.
Default
connection
implementation is usingpoll
/WSAPoll
functions for waiting connection socket to become readable/writable. While this approach works perfectly fine, it does not allow client application to do something else while waiting for connection socket.In this pull request, I have introduced an abstract base class
custom_io_poller
, where concrete implementations of this class is responsible for monitoring a socket with timeout. Each connection keeps a pointer to the associated I/O poller, which is set tonullptr
by default. On each invocation ofconnection::wait
, connection will either call external I/O poller or poll the socket by itself.This would make it possible to integrate taoPQ with Asio/Boost.Asio or similar async I/O frameworks. Could you consider adding such custom polling support to taoPQ prior to first public release?
Thanks.