The I/O event loop class.  
 More...
#include "loop.hpp"
|  | 
| using | uv_t = ::uv_loop_t | 
|  | 
| using | on_destroy_t = std::function< void(void *_data) > | 
|  | The function type of the callback called when the loop instance is about to be destroyed. 
 | 
|  | 
| using | on_exit_t = std::function< void(loop _loop) > | 
|  | The function type of the callback called after the loop exit. 
 | 
|  | 
| template<typename... _Args_> | 
| using | on_walk_t = std::function< void(handle _handle, _Args_ &&... _args) > | 
|  | The function type of the callback called by the walk()function.  More...
 | 
|  | 
|  | 
|  | loop () | 
|  | Create a new event loop. 
 | 
|  | 
|  | loop (const loop &_that) | 
|  | 
| loop & | operator= (const loop &_that) | 
|  | 
|  | loop (loop &&_that) noexcept | 
|  | 
| loop & | operator= (loop &&_that) noexcept | 
|  | 
| void | swap (loop &_that) noexcept | 
|  | 
| long | nrefs () const noexcept | 
|  | The current number of existing references to the same loop as this variable refers to. 
 | 
|  | 
| int | uv_status () const noexcept | 
|  | The status value returned by the last executed libuv API function. 
 | 
|  | 
| on_destroy_t & | on_destroy () const noexcept | 
|  | 
| on_exit_t & | on_exit () const noexcept | 
|  | 
| void *const  & | data () const noexcept | 
|  | 
| void *& | data () noexcept | 
|  | 
| template<typename... _Args_> | 
| int | configure (::uv_loop_option _opt, _Args_ &&... _args) | 
|  | Set additional loop options.  More... 
 | 
|  | 
| int | run (::uv_run_mode _mode) | 
|  | Go into a loop and process events and their callbacks with the current thread.  More... 
 | 
|  | 
| void | stop () | 
|  | Stop the event loop.  More... 
 | 
|  | 
| int | is_alive () const noexcept | 
|  | Returns non-zero if there are active handles or request in the loop. 
 | 
|  | 
| int | backend_fd () const noexcept | 
|  | 
| int | backend_timeout () const noexcept | 
|  | Get the poll timeout. The return value is in milliseconds, or -1 for no timeout. 
 | 
|  | 
| uint64_t | now () const noexcept | 
|  | 
| void | update_time () noexcept | 
|  | 
| template<class _Func_ , typename... _Args_, typename  = std::enable_if_t< std::is_convertible< _Func_, on_walk_t< _Args_&&... > >::value >> | 
| void | walk (_Func_ &&_walk_cb, _Args_ &&... _args) | 
|  | 
|  | operator const uv_t * () const noexcept | 
|  | 
|  | operator uv_t * () noexcept | 
|  | 
|  | operator bool () const noexcept | 
|  | Equivalent to (uv_status() >= 0).
 | 
|  | 
|  | 
| static loop & | Default () noexcept | 
|  | Returns the initialized loop that can be used as a global default loop throughout the program.  More... 
 | 
|  | 
The I/O event loop class. 
All event loops (including the default one) are the instances of this class. 
- See also
- libuv API documentation: uv_loop_t.
Definition at line 33 of file loop.hpp.
◆ on_walk_t
template<typename... _Args_> 
      
 
 
◆ Default()
  
  | 
        
          | static loop& uv::loop::Default | ( |  | ) |  |  | inlinestaticnoexcept | 
 
Returns the initialized loop that can be used as a global default loop throughout the program. 
Definition at line 220 of file loop.hpp.
 
 
◆ data()
  
  | 
        
          | void* const& uv::loop::data | ( |  | ) | const |  | inlinenoexcept | 
 
The pointer to the user-defined arbitrary data. 
- See also
- libuv API documentation: uv_loop_t.data.
Definition at line 238 of file loop.hpp.
 
 
◆ configure()
template<typename... _Args_> 
  
  | 
        
          | int uv::loop::configure | ( | ::uv_loop_option | _opt, |  
          |  |  | _Args_ &&... | _args |  
          |  | ) |  |  |  | inline | 
 
 
◆ run()
  
  | 
        
          | int uv::loop::run | ( | ::uv_run_mode | _mode | ) |  |  | inline | 
 
Go into a loop and process events and their callbacks with the current thread. 
The function acts and returns depending on circumstances which processing is defined by the _mode argument. 
- See also
- libuv API documentation: uv_run(),uv_run_mode.
- Note
- If you start a loop with this function within a callback executed by another loop the first one will be "blocked" until the second started loop ends and the function returns. 
Definition at line 255 of file loop.hpp.
 
 
◆ stop()
Stop the event loop. 
- See also
- libuv API documentation: uv_stop().
Definition at line 272 of file loop.hpp.
 
 
◆ backend_fd()
  
  | 
        
          | int uv::loop::backend_fd | ( |  | ) | const |  | inlinenoexcept | 
 
 
◆ now()
  
  | 
        
          | uint64_t uv::loop::now | ( |  | ) | const |  | inlinenoexcept | 
 
Return the current timestamp in milliseconds. 
- See also
- libuv API documentation: uv_now().
Definition at line 284 of file loop.hpp.
 
 
◆ update_time()
  
  | 
        
          | void uv::loop::update_time | ( |  | ) |  |  | inlinenoexcept | 
 
 
◆ walk()
template<class _Func_ , typename... _Args_, typename  = std::enable_if_t< std::is_convertible< _Func_, on_walk_t< _Args_&&... > >::value >> 
  
  | 
        
          | void uv::loop::walk | ( | _Func_ && | _walk_cb, |  
          |  |  | _Args_ &&... | _args |  
          |  | ) |  |  |  | inline | 
 
Walk the list of active handles referenced by the loop: for each handle _walk_cb will be executed with the given _args. 
- Note
- All arguments are copied (or moved) to the callback function object. For passing arguments by reference when some callback parameters are used as output ones, wrap corresponding arguments with std::ref()or pass them through raw pointer parameters.
Definition at line 298 of file loop.hpp.
 
 
The documentation for this class was generated from the following file: