I wanted to be signaled when stdin has something. Below code works as expected in windows 11.
In windows 11 whatever key you press signals it but in Wine it doesn't matter what key you press nothing happens.
#include <stdio.h>
#include <windows.h>
#include <io.h>
#ifndef STDIN_FILENO
#define STDIN_FILENO 0
#endif
int main(){
HANDLE handles[1];
handles[0] = (HANDLE)_get_osfhandle(STDIN_FILENO);
while(1){
DWORD r = WaitForMultipleObjects(1, handles, FALSE, INFINITE);
if(r != WAIT_OBJECT_0){
printf("error WaitForMultipleObjects %d\n", r);
return 1;
}
printf("stdin is triggered\n");
return 0;
}
}
Why Wine acts different than windows 11? Is something wrong in code?