So, I've run into this issue where I have many threads calling poll on different file descriptors. When I want to add a new one, I need to cancel one of those polls, add a new one, and continue. That alone sounds bad, but also I can't even see how to do that.
Some relevant code:
struct pollfd fds[size];
for(int i = 0;i<size;i++) {
struct pollfd fd;
fd.fd = body[i];
fd.events = POLLIN;
fd.revents = 0;
fds[i] = fd;
}
if(poll(&fds[0], (nfds_t)size, -1) < 0) return NULL;
(I'm using this through JNI also).
I figure I could set a really low delay on poll, and call it over and over, but I think that would begin to defeat the purpose.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire