Browse Source

ckdb - time limited ticker

master
kanoi 10 years ago
parent
commit
e9bd61c212
  1. 29
      src/ckdb.c

29
src/ckdb.c

@ -7382,6 +7382,24 @@ static void *summariser(__maybe_unused void *arg)
return NULL; return NULL;
} }
static uint64_t ticks;
static time_t last_tick;
static void tick()
{
time_t now;
char ch;
now = time(NULL);
if (now > last_tick) {
last_tick = now;
ch = status_chars[ticks++ & 0x3];
putchar(ch);
putchar('\r');
fflush(stdout);
}
}
static bool reload_line(char *filename, uint64_t count, char *buf) static bool reload_line(char *filename, uint64_t count, char *buf)
{ {
char cmd[CMD_SIZ+1], id[ID_SIZ+1]; char cmd[CMD_SIZ+1], id[ID_SIZ+1];
@ -7449,10 +7467,7 @@ static bool reload_line(char *filename, uint64_t count, char *buf)
} }
} }
char ch = status_chars[count & 0x3]; tick();
putchar(ch);
putchar('\r');
fflush(stdout);
K_WLOCK(transfer_free); K_WLOCK(transfer_free);
transfer_root = free_ktree(transfer_root, NULL); transfer_root = free_ktree(transfer_root, NULL);
@ -7720,10 +7735,8 @@ static void *listener(void *arg)
} }
close(sockd); close(sockd);
char ch = status_chars[(counter++) & 0x3]; counter++;
putchar(ch); tick();
putchar('\r');
fflush(stdout);
if (cmdnum == CMD_SHUTDOWN) if (cmdnum == CMD_SHUTDOWN)
break; break;

Loading…
Cancel
Save