Original Post
Will ReadFile / WriteFile ever block when the HANDLE passed in refers to a file?
In linux, I can poll on a bunch of fd's to be sure I can read / write something. Unfortunately, I can't find this equivalent in windows.
So in my app, I have a thread that watches a bunch of fd's and notifies some other object when data is available / can be written. These fd's can be pipes / etc.
I'll deal with the pipes in windows later, but for now, I'm thinking that when some object wants to be notified if it can read / write to a file in windows I'll just immediately post to it that it can. Unless ReadFile / WriteFile from / to a file can block, then I guess I'll have to try some other approach.
Thanks, Brad.
Edit : I guess I could do the WriteFile by making it overlappable and having the user fill a buffer, then when that buffer is written asynchronously, I could post that the stream is writeable again. Unfortunately, I can't think of a way to read like this, unless I read byte-by-byte.
In linux, I can poll on a bunch of fd's to be sure I can read / write something. Unfortunately, I can't find this equivalent in windows.
So in my app, I have a thread that watches a bunch of fd's and notifies some other object when data is available / can be written. These fd's can be pipes / etc.
I'll deal with the pipes in windows later, but for now, I'm thinking that when some object wants to be notified if it can read / write to a file in windows I'll just immediately post to it that it can. Unless ReadFile / WriteFile from / to a file can block, then I guess I'll have to try some other approach.
Thanks, Brad.
Edit : I guess I could do the WriteFile by making it overlappable and having the user fill a buffer, then when that buffer is written asynchronously, I could post that the stream is writeable again. Unfortunately, I can't think of a way to read like this, unless I read byte-by-byte.