When I use the poll function and set the quantity above 1000 it does not sleep at all. Any ideas of what this could be. opengroup says nothing about a limit and I am no where near exhausting my memory space. But when I check the pointer the integer is negative. An开发者_Go百科y ideas of what this could be?
My guess is that your limit for file descriptors is set to 1024. You can see this by running ulimit -n
in bash (unix). For windows see http://support.microsoft.com/kb/111855. If you are running linux, you can increase that limit by modifying /etc/limits.conf (or /etc/security/limits.conf or similar) like:
* soft nofile 10240
* hard nofile 10240
Note that after changing the limits you will have to log out and log back in for it to have the new values.
If poll()
returns a negative number, you should use perror("poll");
to show the reason.
If the reason is "Invalid Argument", it could be for this reason (from the Linux poll()
man page):
EINVAL
The nfds value exceeds the
RLIMIT_NOFILE
value.
By the way, the POSIX spec lists this as an error too:
The poll() function shall fail if: ...
[EINVAL]
Thenfds
argument is greater than{OPEN_MAX}
精彩评论