24PollThread::PollThread(
const char_t *_name)
30bool PollThread::add(
PollAble* _pPollAble,
short _events)
37 _pPollAble->__events = _events;
47bool PollThread::remove(
PollAble* _pPollAble)
63void PollThread::terminate()
80 POLLFD(File::HandleType fd,
short events)
83 this->fd = (SOCKET) fd;
87 this->events = events;
94 return _x.fd == _y.fd;
118 for (UpdateList::Iterator itUpdate =
__updateList.begin();
120 Update& update = *itUpdate;
128 Array<PollAble*>::Iterator itPollAble =
130 if (itPollAble != pollAbles.
end()) {
133 pollAbles.
erase(itPollAble);
144 int r = WSAPoll(fds.
data() + 1, (ULONG)(fds.
size() - 1), WSA_INFINITE);
155 for (
size_t i = 1; i < fds.
size(); i++) {
160 if (!(pPollAble->onEvent(fds[i].revents,
this)))
199 for (Array<PollAble*>::Iterator itPollAble = pollAbles.
begin();
200 itPollAble != pollAbles.
end(); itPollAble++) {
202 if (*itPollAble !=
NULL) {
203 __DCL_TRACE1(
__T(
"terminate remove [%ls]\n"), (*itPollAble)->toString().data());
209 for (UpdateList::Iterator itUpdate =
__updateList.begin();
211 Update& update = *itUpdate;
#define __DCL_TRACE1(fmt, arg1)
#define __DCL_ASSERT(expr)
#define IMPLEMENT_CLASSINFO(class_name, base_class_name)
bool operator==(const POLLFD &_x, const POLLFD &_y)
Iterator erase(Iterator _pos)
ConstIterator end() const
Iterator find(const ELEMENT &_element)
Array< ELEMENT > & add(const ELEMENT &_element)
ConstIterator begin() const
size_t index(Iterator _pos) const
HandleType handle() const
virtual String toString() const
virtual String toString() const
virtual void onRemoved(PollAble *_pPollAble)
volatile bool __terminate
Thread::Event __pollInterrupt
Thread::Mutex __updateLock
static void sleep(unsigned int _mills)
static Thread * getCurrentThread()
SingleLock< Mutex > SingleLockMutex
POLLFD(File::HandleType fd, short events)