Skip to content

Commit

Permalink
inputready_fd: not on windows, alas
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Oct 14, 2021
1 parent 666130d commit 4a3d021
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/lib/in.c
Original file line number Diff line number Diff line change
Expand Up @@ -1303,12 +1303,12 @@ getpipes(ipipe pipes[static 2]){
return -1;
}
if(set_fd_cloexec(pipes[0], 1, NULL) || set_fd_nonblocking(pipes[0], 1, NULL)){
logerror("couldn't prep pipe[0] (%d) (%s)\n", pipes[0], strerror(errno));
logerror("couldn't prep pipe[0] (%s)\n", strerror(errno));
endpipes(pipes);
return -1;
}
if(set_fd_cloexec(pipes[1], 1, NULL) || set_fd_nonblocking(pipes[1], 1, NULL)){
logerror("couldn't prep pipe[1] (%d) (%s)\n", pipes[1], strerror(errno));
logerror("couldn't prep pipe[1] (%s)\n", strerror(errno));
endpipes(pipes);
return -1;
}
Expand Down Expand Up @@ -1986,7 +1986,13 @@ int stop_inputlayer(tinfo* ti){
}

int inputready_fd(const inputctx* ictx){
#ifndef __MINGW64__
return ictx->readypipes[0];
#else
(void)ictx;
logerror("readiness descriptor unavailable on windows\n");
return -1;
#endif
}

static inline uint32_t
Expand Down Expand Up @@ -2035,11 +2041,13 @@ internal_get(inputctx* ictx, const struct timespec* ts, ncinput* ni){
char c;
#ifndef __MINGW64__
while(read(ictx->readypipes[0], &c, sizeof(c)) == 1){
// FIXME accelerate?
}
#else
// FIXME windows ReadFile()
#endif
// FIXME accelerate;
while(ReadFile(ictx->readypipes[0], &c, sizeof(c), NULL, NULL)){
// FIXME accelerate?
}
#endif
}
pthread_mutex_unlock(&ictx->ilock);
if(sendsignal){
Expand Down

0 comments on commit 4a3d021

Please sign in to comment.