New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix and clarify async-ready, async-get and async-wait (#71). #72
Conversation
* async.el (async-ready): Ensure proc buffer is alive and return t if buffer is not alive. Fix docstring. (async--wait): Renamed from async-wait. (async-get): Ensure proc buffer is alive. Fix docstring. (async-start): Docstring only.
@jwiegley Please verify I am not wrong in the return value of Thanks. |
|
John Wiegley <notifications@github.com> writes:
async-wait is intended to be a user-facing function that returns when
async-get would not block.
Ok, can you give some examples, perhaps in test file ?
Why did you want to make it private?
I had the impression it was only used internally, but was unsure about
its usage, why I asked ;-).
Thanks.
…--
Thierry
|
The example is simply this: If you call |
* async.el (async-wait): Do it. (async-get): Do it. (async-start): Do it.
John Wiegley <notifications@github.com> writes:
The example is simply this: If you call async-get, it will block until
the future provides a value, and then return that value. If you call
async-wait, it will also block until the future provides a value, but
it does not return that value -- it leaves it unclaimed in the
future. It provides a way to say, "I want to wait until the future is
ready", without doing anything with that value.
Thanks for explanation.
However I think there is a bug here which makes an infloop in `async-wait`
if user touch a key, you can reproduce with following code:
(let ((proc (async-start
(lambda () (sit-for 3) (message "hello") ))))
(async-wait proc))
If you eval this code and touch nothing, it returns nil, ok, but if you
hit a key before it finishes, it hangup forever.
A solution is using `sleep-for` in `async-wait` instead of `sit-for`.
WDYT?
…--
Thierry
|
* async.el (async-wait): Do it.
Sure, that sounds good to me. |
and return t if buffer is not alive. Fix docstring.
(async--wait): Renamed from async-wait.
(async-get): Ensure proc buffer is alive. Fix docstring.
(async-start): Docstring only.