Skip to content

Commit

Permalink
[input] read and write to Windows readiness handles #2244
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Oct 11, 2021
1 parent 98e2817 commit bb5c2ec
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/in.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,14 @@ send_synth_signal(int sig){
static void
mark_pipe_ready(ipipe pipes[static 2]){
char sig = 1;
#ifndef __MINGW64__
if(write(pipes[1], &sig, sizeof(sig)) != 1){
logwarn("error writing to readypipe (%d) (%s)\n", pipes[1], strerror(errno));
#else
DWORD wrote;
if(!WriteFile(pipes[1], &sig, sizeof(sig), &wrote, NULL) || wrote != sizeof(sig)){
logwarn("error writing to readypipe (%u)\n", GetLastError());
#endif
}
}

Expand Down Expand Up @@ -2018,7 +2024,11 @@ internal_get(inputctx* ictx, const struct timespec* ts, ncinput* ni){
}else if(ictx->ivalid){
logtrace("draining event readiness pipe\n");
char c;
#ifndef __MINGW64__
while(read(ictx->readypipes[0], &c, sizeof(c)) == 1){
#else
// FIXME windows ReadFile()
#endif
// FIXME accelerate;
}
}
Expand Down

0 comments on commit bb5c2ec

Please sign in to comment.