How would there be a "disastrous hang"? /.../
It has been discussed later on in this thread. I suggest you read it through before responding.
If you want to "protect" the user from shooting himself in the foot, I'd rather suggest a check in the read() function that you don't have a read_callback at the same time as you are manually doing a read(). That would break fewer programs. I still think it would be unnecessary pampering though.
That's a good suggestion. I see it as a good measure to track down bugs more efficiently; in a high level language I don't see any real point in allowing error prone situations just because it would be "pampering" otherwise. That's rather one of the points with high level languages.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-03-19 15:13: Subject: I/O callbacks in blocking mode
How would there be a "disastrous hang"? The read callback will only be called when there is something to read, in which case read(N,1) returns immediately. If you use read() to empty the data before the callback gets to it, then the read() in the callback will of course block until there's more data, but that's self-inflicted and rather what you expect would happen if you manually do read() on a blocking fd. If you want to "protect" the user from shooting himself in the foot, I'd rather suggest a check in the read() function that you don't have a read_callback at the same time as you are manually doing a read(). That would break fewer programs. I still think it would be unnecessary pampering though.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)