mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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:
@@ -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
|
||||
|
Reference in New Issue
Block a user