Properly migrate from select to poll for core asterisk.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2760 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-04-25 20:42:45 +00:00
parent 0eca3cf384
commit 435e55958f
4 changed files with 151 additions and 101 deletions

View File

@@ -20,6 +20,7 @@
#include <unistd.h>
#include <setjmp.h>
#include <pthread.h>
#include <sys/poll.h>
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
@@ -781,6 +782,21 @@ int ast_do_masquerade(struct ast_channel *chan);
/* Misc. functions below */
/* Helper function for migrating select to poll */
static inline int ast_fdisset(struct pollfd *pfds, int fd, int max, int *start)
{
int x;
for (x=start ? *start : 0;x<max;x++)
if (pfds[x].fd == fd) {
if (start) {
if (x==*start)
(*start)++;
}
return pfds[x].revents;
}
return 0;
}
//! Waits for activity on a group of channels
/*!
* \param nfds the maximum number of file descriptors in the sets