Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Distinguish pending and nonpending requests #34

Closed
piscisaureus opened this issue Apr 27, 2011 · 7 comments
Closed

Distinguish pending and nonpending requests #34

piscisaureus opened this issue Apr 27, 2011 · 7 comments
Labels

Comments

@piscisaureus
Copy link

As discussed, oio_write, oio_read and oio_connect might complete synchronously. When that happens the request callback will not be made. How do we tell the user that this happened?

options:

  • Return 0 on immediate completion, return -1 and set the last error to OIO_PENDING when the request pends.
  • Return 0 on immediate completion, -1 on error, and -2 when the request pends.

remarks:

  • Maybe It's hard to imagine a situation where a connect completes immediately. However, the windows ConnectEx call I'm making does not guarantee that the overlapped operation always returns WSA_IO_PENDING. Also it is not unexpected that connecting a pipe / fifo could be done synchronously.
  • Implementations might choose to always report that a request is pending. For example, windows XP always reports completion asynchronously even if a request could be serviced immediately. (on later windowses this behavior can be specified with SetFileCompletionNotificationModes).
@ry
Copy link
Contributor

ry commented Apr 27, 2011

also it does not call the callback on immediate completion.

I like option one - as it's more windows-y

@piscisaureus
Copy link
Author

"When that happens the request callback will not be made."
I think we agreed on beforehand. :-)

@ry
Copy link
Contributor

ry commented Apr 27, 2011

How do you get the return value of oio_read - number of bytes read?

@piscisaureus
Copy link
Author

Return it? Use int instead of size_t. Also merge the status and nread arguments for oio_read_cb, make that an int too. People are not going to read/write > 2gb of data in one req anyway.

@ry
Copy link
Contributor

ry commented Apr 27, 2011

Why int? Should be ssize_t

@piscisaureus
Copy link
Author

Oh yes that's okay -- I wasn't aware of the existence of ssize_t.

@piscisaureus
Copy link
Author

This idea was dropped -- all requests will complete async. Closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants