I removed the locks of pthread_mutex_lock/and release as socket
libraries are thread safe.
Now my question is there a possibility of hang in the select function
when read file descriptors are not available?Also can the timeout of
25 sec contribute to the hang?
How can I check the read_fds are not available or the threshold is
being reached.
Any comments or suggestions would be very much appreciated.
Thanks
Arnab
Your question is not clear. What do you mean by "possibility of hang"?
select is supposed to block the thread untill one of the descriptors
becomes ready. There is common mistake with select when people forget to
initiate the descriptors set before EVERY call to select, as result the
select gets no descriptors and just sits there till time-out expires.
See if you make such mistake. Though I recommend you to buy book of
Stevens "Unix network programming" Volume 1. After reading it you'll get
the answers to all your questions.
--
Minds, like parachutes, function best when open
Thanks for all help.Actually so far my observation,I have seen under
the heavy load of the server it pauses in the select system call for
some secs.I have a select on the read file descriptor with timeout as
25 sec save.This behavior is never observed when the load on the
server is less.
Is it like under the heavy load the read descriptors are not available
for which it pauses and waits for the timeouts?Within that timeout if
it gets it will proceed?Let me know your views?Also is there a way to
find out whether my descriptors upper limit value is reached hence no
more available ?Also how do I increase the descriptors ?Do I need to
modify FD_SETSIZE?
Thanks in advance.
Arnab