|
|
|
@@ -0,0 +1,70 @@ |
|
|
|
#pragma once |
|
|
|
|
|
|
|
#include <chrono> |
|
|
|
|
|
|
|
#include "fdset.h" |
|
|
|
|
|
|
|
namespace cppcore |
|
|
|
{ |
|
|
|
|
|
|
|
/** |
|
|
|
* @brief Wait for the file descriptors passed in the file descriptor sets until |
|
|
|
* any file descriptor is read. |
|
|
|
* |
|
|
|
* @param[in] fd_count Number of file descriptor stored in the file descriptor sets. |
|
|
|
* @param[in] read File descriptor set to wait for read operations. |
|
|
|
* @param[in] write File descriptor set to wait for write operations. |
|
|
|
* @param[in] except File descriptor set to wait for a exceptional state. |
|
|
|
* |
|
|
|
* @return Number of active file descriptors. |
|
|
|
*/ |
|
|
|
inline uint select( |
|
|
|
int fd_count, |
|
|
|
fdset& read, |
|
|
|
fdset& write, |
|
|
|
fdset& except); |
|
|
|
|
|
|
|
/** |
|
|
|
* @brief Wait for the file descriptors passed in the file descriptor sets until |
|
|
|
* any file descriptor is read, or the timeout has occured. |
|
|
|
* |
|
|
|
* @param[in] fd_count Number of file descriptor stored in the file descriptor sets. |
|
|
|
* @param[in] read File descriptor set to wait for read operations. |
|
|
|
* @param[in] write File descriptor set to wait for write operations. |
|
|
|
* @param[in] except File descriptor set to wait for a exceptional state. |
|
|
|
* @param[in] timeout Relative timeout to wait for te file descriptors. |
|
|
|
* May be updated to the time left after select returned. |
|
|
|
* |
|
|
|
* @return Number of active file descriptors. |
|
|
|
*/ |
|
|
|
template<typename T_rep, typename T_period> |
|
|
|
inline uint select( |
|
|
|
int fd_count, |
|
|
|
fdset& read, |
|
|
|
fdset& write, |
|
|
|
fdset& except, |
|
|
|
std::chrono::duration<T_rep, T_period>& timeout); |
|
|
|
|
|
|
|
/** |
|
|
|
* @brief Wait for the file descriptors passed in the file descriptor sets until |
|
|
|
* any file descriptor is read, or the timeout has occured. |
|
|
|
* |
|
|
|
* @param[in] fd_count Number of file descriptor stored in the file descriptor sets. |
|
|
|
* @param[in] read File descriptor set to wait for read operations. |
|
|
|
* @param[in] write File descriptor set to wait for write operations. |
|
|
|
* @param[in] except File descriptor set to wait for a exceptional state. |
|
|
|
* @param[in] timeout Relative timeout to wait for te file descriptors. |
|
|
|
* |
|
|
|
* @return Number of active file descriptors. |
|
|
|
*/ |
|
|
|
template<typename T_rep, typename T_period> |
|
|
|
inline uint select( |
|
|
|
int fd_count, |
|
|
|
fdset& read, |
|
|
|
fdset& write, |
|
|
|
fdset& except, |
|
|
|
const std::chrono::duration<T_rep, T_period>& timeout); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#include "select.inl" |