|  | Tacopie
    3.0.0
    Tacopie is a TCP Client & Server C++11 library. | 
#include <io_service.hpp>
| Public Types | |
| typedef std::function< void(fd_t)> | event_callback_t | 
| Public Member Functions | |
| io_service (void) | |
| ~io_service (void) | |
| dtor | |
| io_service (const io_service &)=delete | |
| copy ctor | |
| io_service & | operator= (const io_service &)=delete | 
| assignment operator | |
| void | set_nb_workers (std::size_t nb_threads) | 
| void | track (const tcp_socket &socket, const event_callback_t &rd_callback=nullptr, const event_callback_t &wr_callback=nullptr) | 
| void | set_rd_callback (const tcp_socket &socket, const event_callback_t &event_callback) | 
| void | set_wr_callback (const tcp_socket &socket, const event_callback_t &event_callback) | 
| void | untrack (const tcp_socket &socket) | 
| void | wait_for_removal (const tcp_socket &socket) | 
service that operates IO Handling. It polls sockets for input and output, processes read and write operations and calls the appropriate callbacks.
| typedef std::function<void(fd_t)> tacopie::io_service::event_callback_t | 
callback handler typedef called on new socket event if register to io_service
| tacopie::io_service::io_service | ( | void | ) | 
ctor
| void tacopie::io_service::set_nb_workers | ( | std::size_t | nb_threads | ) | 
reset number of io_service workers assigned to this io_service this can be safely called at runtime, even if the io_service is currently running it can be useful if you need to re-adjust the number of workers
| nb_threads | number of workers | 
| void tacopie::io_service::set_rd_callback | ( | const tcp_socket & | socket, | 
| const event_callback_t & | event_callback | ||
| ) | 
update the read callback if socket is not tracked yet, track it
| socket | socket to be tracked | 
| event_callback | callback to be executed on read event | 
| void tacopie::io_service::set_wr_callback | ( | const tcp_socket & | socket, | 
| const event_callback_t & | event_callback | ||
| ) | 
update the write callback if socket is not tracked yet, track it
| socket | socket to be tracked | 
| event_callback | callback to be executed on write event | 
| void tacopie::io_service::track | ( | const tcp_socket & | socket, | 
| const event_callback_t & | rd_callback = nullptr, | ||
| const event_callback_t & | wr_callback = nullptr | ||
| ) | 
track socket add socket to io_service tracking for read/write operation socket is polled only if read or write callback is defined
| socket | socket to be tracked | 
| rd_callback | callback to be executed on read event | 
| wr_callback | callback to be executed on write event | 
| void tacopie::io_service::untrack | ( | const tcp_socket & | socket | ) | 
remove socket from io_service tracking socket is marked for untracking and will effectively be removed asynchronously from tracking once
re-adding track while socket is pending for untrack is fine and will simply cancel the untrack operation
| socket | socket to be untracked | 
| void tacopie::io_service::wait_for_removal | ( | const tcp_socket & | socket | ) | 
wait until the socket has been effectively removed basically wait until all pending callbacks are executed
| socket | socket to wait for | 
 1.8.13
 1.8.13