User:Kr/On Streams

From Apache OpenOffice Wiki
Jump to: navigation, search

I spend some thoughts on differences / similarities between working with block files (like filesystem files) and characters files (like sockets) wrt event driven programming. Especially it was unsure to me, why I could use O_ASYNC on character files and not on block files, despite I could use select or poll for both.

To understand that block files actually are the same as character files, one needs to see the fact, that opening a block file is requesting data from a source exactly like connecting to a server is requesting data from a source. Just imagine a request to a harddisk to read some sectors in an asynchronous way, the harddisk sending the results of the request later on as an reply (or event (e.g. a signal), being some kind of remote communication in both cases.

Finally the point being, that there is no reason that O_ASYNC couldn't work on block files as well ...

Personal tools