remove support for faking notifications
with the existence of timers, this is now superfluous.
This commit is contained in:
parent
a4e2f1a60d
commit
3f629af07e
|
@ -140,7 +140,6 @@ typedef struct notifier {
|
|||
#else
|
||||
int fd, events;
|
||||
#endif
|
||||
int faked;
|
||||
} notifier_t;
|
||||
|
||||
#ifdef HAVE_SYS_POLL_H
|
||||
|
@ -153,7 +152,6 @@ typedef struct notifier {
|
|||
|
||||
void init_notifier( notifier_t *sn, int fd, void (*cb)( int, void * ), void *aux );
|
||||
void conf_notifier( notifier_t *sn, int and_events, int or_events );
|
||||
static INLINE void fake_notifier( notifier_t *sn, int events ) { sn->faked |= events; }
|
||||
void wipe_notifier( notifier_t *sn );
|
||||
|
||||
typedef struct {
|
||||
|
|
29
src/util.c
29
src/util.c
|
@ -636,7 +636,6 @@ init_notifier( notifier_t *sn, int fd, void (*cb)( int, void * ), void *aux )
|
|||
#endif
|
||||
sn->cb = cb;
|
||||
sn->aux = aux;
|
||||
sn->faked = 0;
|
||||
sn->next = notifiers;
|
||||
notifiers = sn;
|
||||
}
|
||||
|
@ -762,20 +761,19 @@ event_wait( void )
|
|||
}
|
||||
timeout = delta * 1000;
|
||||
}
|
||||
for (sn = notifiers; sn; sn = sn->next)
|
||||
if (sn->faked) {
|
||||
timeout = 0;
|
||||
break;
|
||||
}
|
||||
if (poll( pollfds, npolls, timeout ) < 0) {
|
||||
switch (poll( pollfds, npolls, timeout )) {
|
||||
case 0:
|
||||
return;
|
||||
case -1:
|
||||
perror( "poll() failed in event loop" );
|
||||
abort();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
for (sn = notifiers; sn; sn = sn->next) {
|
||||
int n = sn->index;
|
||||
if ((m = pollfds[n].revents | sn->faked)) {
|
||||
if ((m = pollfds[n].revents)) {
|
||||
assert( !(m & POLLNVAL) );
|
||||
sn->faked = 0;
|
||||
sn->cb( m | shifted_bit( m, POLLHUP, POLLIN ), sn->aux );
|
||||
if (changed) {
|
||||
changed = 0;
|
||||
|
@ -786,7 +784,6 @@ event_wait( void )
|
|||
#else
|
||||
struct timeval *timeout = 0;
|
||||
struct timeval to_tv;
|
||||
static struct timeval null_tv;
|
||||
fd_set rfds, wfds, efds;
|
||||
int fd;
|
||||
|
||||
|
@ -808,8 +805,6 @@ event_wait( void )
|
|||
FD_ZERO( &efds );
|
||||
m = -1;
|
||||
for (sn = notifiers; sn; sn = sn->next) {
|
||||
if (sn->faked)
|
||||
timeout = &null_tv;
|
||||
fd = sn->fd;
|
||||
if (sn->events & POLLIN)
|
||||
FD_SET( fd, &rfds );
|
||||
|
@ -819,13 +814,18 @@ event_wait( void )
|
|||
if (fd > m)
|
||||
m = fd;
|
||||
}
|
||||
if (select( m + 1, &rfds, &wfds, &efds, timeout ) < 0) {
|
||||
switch (select( m + 1, &rfds, &wfds, &efds, timeout )) {
|
||||
case 0:
|
||||
return;
|
||||
case -1:
|
||||
perror( "select() failed in event loop" );
|
||||
abort();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
for (sn = notifiers; sn; sn = sn->next) {
|
||||
fd = sn->fd;
|
||||
m = sn->faked;
|
||||
m = 0;
|
||||
if (FD_ISSET( fd, &rfds ))
|
||||
m |= POLLIN;
|
||||
if (FD_ISSET( fd, &wfds ))
|
||||
|
@ -833,7 +833,6 @@ event_wait( void )
|
|||
if (FD_ISSET( fd, &efds ))
|
||||
m |= POLLERR;
|
||||
if (m) {
|
||||
sn->faked = 0;
|
||||
sn->cb( m, sn->aux );
|
||||
if (changed) {
|
||||
changed = 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user