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
|
#else
|
||||||
int fd, events;
|
int fd, events;
|
||||||
#endif
|
#endif
|
||||||
int faked;
|
|
||||||
} notifier_t;
|
} notifier_t;
|
||||||
|
|
||||||
#ifdef HAVE_SYS_POLL_H
|
#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 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 );
|
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 );
|
void wipe_notifier( notifier_t *sn );
|
||||||
|
|
||||||
typedef struct {
|
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
|
#endif
|
||||||
sn->cb = cb;
|
sn->cb = cb;
|
||||||
sn->aux = aux;
|
sn->aux = aux;
|
||||||
sn->faked = 0;
|
|
||||||
sn->next = notifiers;
|
sn->next = notifiers;
|
||||||
notifiers = sn;
|
notifiers = sn;
|
||||||
}
|
}
|
||||||
|
@ -762,20 +761,19 @@ event_wait( void )
|
||||||
}
|
}
|
||||||
timeout = delta * 1000;
|
timeout = delta * 1000;
|
||||||
}
|
}
|
||||||
for (sn = notifiers; sn; sn = sn->next)
|
switch (poll( pollfds, npolls, timeout )) {
|
||||||
if (sn->faked) {
|
case 0:
|
||||||
timeout = 0;
|
return;
|
||||||
break;
|
case -1:
|
||||||
}
|
|
||||||
if (poll( pollfds, npolls, timeout ) < 0) {
|
|
||||||
perror( "poll() failed in event loop" );
|
perror( "poll() failed in event loop" );
|
||||||
abort();
|
abort();
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
for (sn = notifiers; sn; sn = sn->next) {
|
for (sn = notifiers; sn; sn = sn->next) {
|
||||||
int n = sn->index;
|
int n = sn->index;
|
||||||
if ((m = pollfds[n].revents | sn->faked)) {
|
if ((m = pollfds[n].revents)) {
|
||||||
assert( !(m & POLLNVAL) );
|
assert( !(m & POLLNVAL) );
|
||||||
sn->faked = 0;
|
|
||||||
sn->cb( m | shifted_bit( m, POLLHUP, POLLIN ), sn->aux );
|
sn->cb( m | shifted_bit( m, POLLHUP, POLLIN ), sn->aux );
|
||||||
if (changed) {
|
if (changed) {
|
||||||
changed = 0;
|
changed = 0;
|
||||||
|
@ -786,7 +784,6 @@ event_wait( void )
|
||||||
#else
|
#else
|
||||||
struct timeval *timeout = 0;
|
struct timeval *timeout = 0;
|
||||||
struct timeval to_tv;
|
struct timeval to_tv;
|
||||||
static struct timeval null_tv;
|
|
||||||
fd_set rfds, wfds, efds;
|
fd_set rfds, wfds, efds;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
@ -808,8 +805,6 @@ event_wait( void )
|
||||||
FD_ZERO( &efds );
|
FD_ZERO( &efds );
|
||||||
m = -1;
|
m = -1;
|
||||||
for (sn = notifiers; sn; sn = sn->next) {
|
for (sn = notifiers; sn; sn = sn->next) {
|
||||||
if (sn->faked)
|
|
||||||
timeout = &null_tv;
|
|
||||||
fd = sn->fd;
|
fd = sn->fd;
|
||||||
if (sn->events & POLLIN)
|
if (sn->events & POLLIN)
|
||||||
FD_SET( fd, &rfds );
|
FD_SET( fd, &rfds );
|
||||||
|
@ -819,13 +814,18 @@ event_wait( void )
|
||||||
if (fd > m)
|
if (fd > m)
|
||||||
m = fd;
|
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" );
|
perror( "select() failed in event loop" );
|
||||||
abort();
|
abort();
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
for (sn = notifiers; sn; sn = sn->next) {
|
for (sn = notifiers; sn; sn = sn->next) {
|
||||||
fd = sn->fd;
|
fd = sn->fd;
|
||||||
m = sn->faked;
|
m = 0;
|
||||||
if (FD_ISSET( fd, &rfds ))
|
if (FD_ISSET( fd, &rfds ))
|
||||||
m |= POLLIN;
|
m |= POLLIN;
|
||||||
if (FD_ISSET( fd, &wfds ))
|
if (FD_ISSET( fd, &wfds ))
|
||||||
|
@ -833,7 +833,6 @@ event_wait( void )
|
||||||
if (FD_ISSET( fd, &efds ))
|
if (FD_ISSET( fd, &efds ))
|
||||||
m |= POLLERR;
|
m |= POLLERR;
|
||||||
if (m) {
|
if (m) {
|
||||||
sn->faked = 0;
|
|
||||||
sn->cb( m, sn->aux );
|
sn->cb( m, sn->aux );
|
||||||
if (changed) {
|
if (changed) {
|
||||||
changed = 0;
|
changed = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user