mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 15:18:20 +00:00
Add a simple FD_Set wrapper/helper class.
This commit is contained in:
parent
cf66bd8b69
commit
59c54a0fc6
16 changed files with 149 additions and 90 deletions
|
@ -5,8 +5,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <sys/select.h>
|
||||
#include "iosource/FD_Set.h"
|
||||
|
||||
namespace iosource {
|
||||
|
||||
|
@ -115,11 +114,19 @@ private:
|
|||
|
||||
struct Source {
|
||||
IOSource* src;
|
||||
std::vector<int> fd_read;
|
||||
std::vector<int> fd_write;
|
||||
std::vector<int> fd_except;
|
||||
FD_Set fd_read;
|
||||
FD_Set fd_write;
|
||||
FD_Set fd_except;
|
||||
|
||||
bool Ready(fd_set* read, fd_set* write, fd_set* except) const;
|
||||
bool Ready(fd_set* read, fd_set* write, fd_set* except) const
|
||||
{ return fd_read.Ready(read) || fd_write.Ready(write) ||
|
||||
fd_except.Ready(except); }
|
||||
|
||||
void SetFds(fd_set* read, fd_set* write, fd_set* except,
|
||||
int* maxx) const;
|
||||
|
||||
void Clear()
|
||||
{ fd_read.Clear(); fd_write.Clear(); fd_except.Clear(); }
|
||||
};
|
||||
|
||||
typedef std::list<Source*> SourceList;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue