Go to the source code of this file.
|
| #define | xroad_reactor_create(_name, ...) |
| |
|
| enum | xroad_reactor_flags_t { xroad_rf_none = 0u
, xroad_rf_fixed_fd = (1u << 0u)
, xroad_rf_write_append = (2u << 0u)
} |
| |
|
| xroad_reactor_t * | xroad_reactor_create_ex (xroad_str_t name, xroad_reactor_params_t params) |
| |
|
xroad_errno_t | xroad_reactor_set_interval (xroad_reactor_t *r, int wait_time_ms) |
| | Change wait time.
|
| |
| void | xroad_reactor_set_default (xroad_reactor_t *r) |
| |
|
const xroad_reactor_timestamps_t * | xroad_reactor_get_timestamps (xroad_reactor_t *r) __attribute_const__ |
| | Returns pointer to timestamps structure associated with the reactor.
|
| |
| xroad_reactor_t * | xroad_reactor_get_default (void) |
| |
| void | xroad_reactor_destroy (xroad_reactor_t *r) |
| |
| int32_t | xroad_reactor_process (xroad_reactor_t *r) |
| |
| int32_t | xroad_reactor_process_nowait (xroad_reactor_t *r) |
| |
| xroad_errno_t | xroad_reactor_add_epoll (xroad_reactor_t *r, uint32_t events, xroad_epoll_callback_t *cback, uint8_t flags) |
| |
| xroad_errno_t | xroad_reactor_mod_epoll (xroad_reactor_t *r, uint32_t events, xroad_epoll_callback_t *cback, uint8_t flags) |
| |
| int32_t | xroad_reactor_get_epoll_fd (xroad_reactor_t *r) |
| |
| int | xroad_reactor_reg_fd (xroad_reactor_t *r, int fd) |
| |
|
int | xroad_reactor_unreg_fd (xroad_reactor_t *r, int reg_fd) |
| | Unregister the file descriptor.
|
| |
|
int | xroad_reactor_reg_fd_to_fd (xroad_reactor_t *r, int reg_fd) |
| | Get real (native) file descriptor by registered one (registration index)
|
| |
◆ xroad_reactor_create
| #define xroad_reactor_create |
( |
|
_name, |
|
|
|
... |
|
) |
| |
Value: ({ \
xroad_reactor_create_ex(_name, args); \
})
Structure of parameters.
Definition: xroad_reactor.h:23
◆ xroad_reactor_add_epoll()
add descriptor to epoll
- Parameters
-
| [in] | r | - reactor instance or null to use the default one |
| [in] | events | - fd events |
| [in] | cback | - pointer to epoll callback |
| [in] | flags | - additional flags from xroad_reactor_flags_t |
- Returns
- XROAD_ERROR_OK - done
◆ xroad_reactor_create_ex()
Create a new reactor instance
- Parameters
-
| name | – some name for the reactor. It's only used for its logger. |
| params | – parameters |
- Returns
- – created reactor or NULL in case of error
◆ xroad_reactor_destroy()
Destroy the reactor
- Parameters
-
◆ xroad_reactor_get_default()
Get the default thread-local reactor
- Returns
- - default reactor for current thread or NULL if it's not set.
◆ xroad_reactor_get_epoll_fd()
return epoll file descriptor
- Parameters
-
| [in] | r | - reactor instance or null to use the default one |
- Returns
- - epoll_fd
◆ xroad_reactor_mod_epoll()
modify or delete (events = 0) the descriptor from polling
- Parameters
-
| [in] | r | - reactor instance or null to use the default one |
| [in] | events | - new fd events (0u to delete) |
| [in] | cback | - pointer to epoll callback |
| [in] | flags | - RESERVED. additional flags from xroad_reactor_flags_t |
- Returns
- XROAD_ERROR_OK - done
◆ xroad_reactor_process()
Receive and dispatch events and callbacks. Use configured timeout.
- Parameters
-
| r | - reactor instance or null to use the default one |
- Returns
- - >= 0 number of dispatched events, < 0 - error happened (see xroad_errno_t)
◆ xroad_reactor_process_nowait()
Receive and dispatch events and callbacks without waiting.
- Parameters
-
| r | - reactor instance or null to use the default one |
- Returns
- - >= 0 number of dispatched events, < 0 - error happened (see xroad_errno_t)
◆ xroad_reactor_reg_fd()
Register a file descriptor.
NB Please specify xroad_rf_fixed_fd flag to indicate the fd is registered index instead of native fd.
- Parameters
-
| r | - reactor |
| fd | - real (native) file descriptor |
- Returns
- - registered fd (non-negative) or error (xroad_errno_t).
◆ xroad_reactor_set_default()
Set a default reactor for current thread
- Parameters
-
| [in] | - | reactor to set as the default one |