Archived
This forum has been archived. Please start a new discussion on GitHub.
Question on ThreadPool
I am reading ICE source code now. a question is here:
It seems class ThreadPool&EventHandler use Leader/Followers pattern. in method IceInternal::ThreadPool::run(), first check if any register/unregister event from pipe, then find a readable fd, read message, after message read complete, call handler's message(). promote will happened in message().
like following code fragement:
bool IceInternal::ThreadPool::run()
{
...
ret = ::select(_maxFd + 1, &fdSet, 0, 0, 0);
...
if(FD_ISSET(_fdIntrRead, &fdSet))
{...}
else
{
...
{}
while(!FD_ISSET(_lastFd, &fdSet) && loops <= 1);
...
}
read(handler); // read message here.
...
handler->message(stream, self); // threadPool->promoteFollower(); in message()
...
}
My question is:
There's no Leader thread monitor event until current leader read a complete message. if reading is overtime, server can do nothing until timedout.
Am i right? anyone can help me?
It seems class ThreadPool&EventHandler use Leader/Followers pattern. in method IceInternal::ThreadPool::run(), first check if any register/unregister event from pipe, then find a readable fd, read message, after message read complete, call handler's message(). promote will happened in message().
like following code fragement:
bool IceInternal::ThreadPool::run()
{
...
ret = ::select(_maxFd + 1, &fdSet, 0, 0, 0);
...
if(FD_ISSET(_fdIntrRead, &fdSet))
{...}
else
{
...
{}
while(!FD_ISSET(_lastFd, &fdSet) && loops <= 1);
...
}
read(handler); // read message here.
...
handler->message(stream, self); // threadPool->promoteFollower(); in message()
...
}
My question is:
There's no Leader thread monitor event until current leader read a complete message. if reading is overtime, server can do nothing until timedout.
Am i right? anyone can help me?
0
Comments
-
I'm sorry, but explaining Ice internals, such as how exactly the thread pool works internally, is out of the scope of the free support we can provide here on these forums.0