event/PollGroupWinSelect: use `SOCKET` instead of `int`
This commit is contained in:
parent
41bc17a27f
commit
8b94e8f260
|
@ -45,7 +45,7 @@ PollGroupWinSelect::CanModify(PollGroupWinSelect::Item &item,
|
|||
}
|
||||
|
||||
void
|
||||
PollGroupWinSelect::Modify(PollGroupWinSelect::Item &item, int fd,
|
||||
PollGroupWinSelect::Modify(PollGroupWinSelect::Item &item, SOCKET fd,
|
||||
unsigned events, int event_id) noexcept
|
||||
{
|
||||
int index = item.index[event_id];
|
||||
|
@ -64,7 +64,7 @@ PollGroupWinSelect::Modify(PollGroupWinSelect::Item &item, int fd,
|
|||
}
|
||||
|
||||
bool
|
||||
PollGroupWinSelect::Add(int fd, unsigned events, void *obj) noexcept
|
||||
PollGroupWinSelect::Add(SOCKET fd, unsigned events, void *obj) noexcept
|
||||
{
|
||||
assert(items.find(fd) == items.end());
|
||||
auto &item = items[fd];
|
||||
|
@ -89,7 +89,7 @@ PollGroupWinSelect::Add(int fd, unsigned events, void *obj) noexcept
|
|||
}
|
||||
|
||||
bool
|
||||
PollGroupWinSelect::Modify(int fd, unsigned events, void *obj) noexcept
|
||||
PollGroupWinSelect::Modify(SOCKET fd, unsigned events, void *obj) noexcept
|
||||
{
|
||||
auto item_iter = items.find(fd);
|
||||
assert(item_iter != items.end());
|
||||
|
@ -107,7 +107,7 @@ PollGroupWinSelect::Modify(int fd, unsigned events, void *obj) noexcept
|
|||
}
|
||||
|
||||
bool
|
||||
PollGroupWinSelect::Remove(int fd) noexcept
|
||||
PollGroupWinSelect::Remove(SOCKET fd) noexcept
|
||||
{
|
||||
auto item_iter = items.find(fd);
|
||||
assert(item_iter != items.end());
|
||||
|
|
|
@ -67,12 +67,12 @@ public:
|
|||
return set.fd_count == FD_SETSIZE;
|
||||
}
|
||||
|
||||
int operator[](size_t index) const noexcept {
|
||||
SOCKET operator[](size_t index) const noexcept {
|
||||
assert(index < set.fd_count);
|
||||
return set.fd_array[index];
|
||||
}
|
||||
|
||||
size_t Add(int fd) noexcept {
|
||||
size_t Add(SOCKET fd) noexcept {
|
||||
assert(!IsFull());
|
||||
set.fd_array[set.fd_count] = fd;
|
||||
return set.fd_count++;
|
||||
|
@ -103,7 +103,7 @@ class PollGroupWinSelect
|
|||
|
||||
bool CanModify(Item &item, unsigned events,
|
||||
int event_id) const noexcept;
|
||||
void Modify(Item &item, int fd, unsigned events,
|
||||
void Modify(Item &item, SOCKET fd, unsigned events,
|
||||
int event_id) noexcept;
|
||||
|
||||
PollGroupWinSelect(PollGroupWinSelect &) = delete;
|
||||
|
@ -118,10 +118,10 @@ public:
|
|||
~PollGroupWinSelect() noexcept;
|
||||
|
||||
void ReadEvents(PollResultGeneric &result, int timeout_ms) noexcept;
|
||||
bool Add(int fd, unsigned events, void *obj) noexcept;
|
||||
bool Modify(int fd, unsigned events, void *obj) noexcept;
|
||||
bool Remove(int fd) noexcept;
|
||||
bool Abandon(int fd) noexcept {
|
||||
bool Add(SOCKET fd, unsigned events, void *obj) noexcept;
|
||||
bool Modify(SOCKET fd, unsigned events, void *obj) noexcept;
|
||||
bool Remove(SOCKET fd) noexcept;
|
||||
bool Abandon(SOCKET fd) noexcept {
|
||||
return Remove(fd);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue