mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 21:21:15 -03:00
Implement universal variable deletion. Adopt shared memory uvar notification.
This commit is contained in:
@@ -96,7 +96,7 @@ static wint_t readb()
|
||||
input_flush_callbacks();
|
||||
|
||||
fd_set fdset;
|
||||
int fd_max=0;
|
||||
int fd_max = 0;
|
||||
int ioport = iothread_port();
|
||||
int res;
|
||||
|
||||
@@ -105,15 +105,32 @@ static wint_t readb()
|
||||
if (env_universal_server.fd > 0)
|
||||
{
|
||||
FD_SET(env_universal_server.fd, &fdset);
|
||||
if (fd_max < env_universal_server.fd) fd_max = env_universal_server.fd;
|
||||
fd_max = maxi(fd_max, env_universal_server.fd);
|
||||
}
|
||||
if (ioport > 0)
|
||||
{
|
||||
FD_SET(ioport, &fdset);
|
||||
if (fd_max < ioport) fd_max = ioport;
|
||||
fd_max = maxi(fd_max, ioport);
|
||||
}
|
||||
|
||||
/* Get our uvar notifier */
|
||||
universal_notifier_t ¬ifier = universal_notifier_t::default_notifier();
|
||||
|
||||
/* Get the suggested delay */
|
||||
struct timeval tv = {};
|
||||
const unsigned long usecs_delay = notifier.usec_delay_between_polls();
|
||||
if (usecs_delay > 0)
|
||||
{
|
||||
unsigned long usecs_per_sec = 1000000;
|
||||
tv.tv_sec = (int)(usecs_delay / usecs_per_sec);
|
||||
tv.tv_usec = (int)(usecs_delay % usecs_per_sec);
|
||||
}
|
||||
|
||||
res = select(fd_max + 1, &fdset, 0, 0, usecs_delay > 0 ? &tv : NULL);
|
||||
if (res == 0)
|
||||
{
|
||||
fprintf(stderr, "ping\n");
|
||||
}
|
||||
|
||||
res = select(fd_max + 1, &fdset, 0, 0, 0);
|
||||
if (res==-1)
|
||||
{
|
||||
switch (errno)
|
||||
@@ -162,6 +179,12 @@ static wint_t readb()
|
||||
return lookahead_pop();
|
||||
}
|
||||
}
|
||||
|
||||
if (notifier.poll())
|
||||
{
|
||||
fprintf(stderr, "Change note\n");
|
||||
env_universal_barrier();
|
||||
}
|
||||
|
||||
if (ioport > 0 && FD_ISSET(ioport, &fdset))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user