- tv.tv_sec = timeout / 1000000;
- tv.tv_usec = timeout % 1000000;
- if(write) {
- if (select(Fd+1,&Set,0,0,&tv) <= 0)
- return false;
- } else {
- if (select(Fd+1,0,&Set,0,&tv) <= 0)
- return false;
+ tv.tv_sec = timeout;
+ tv.tv_usec = 0;
+ if (write == true)
+ {
+ int Res;
+ do
+ {
+ Res = select(Fd+1,0,&Set,0,(timeout != 0?&tv:0));
+ }
+ while (Res < 0 && errno == EINTR);
+
+ if (Res <= 0)
+ return false;
+ }
+ else
+ {
+ int Res;
+ do
+ {
+ Res = select(Fd+1,&Set,0,0,(timeout != 0?&tv:0));
+ }
+ while (Res < 0 && errno == EINTR);
+
+ if (Res <= 0)
+ return false;