On 03/12/11 08.56, Vladimir Panteleev wrote:
On Sat, 03 Dec 2011 06:26:10 +0200, dsimcha <dsim...@yahoo.com> wrote:
<snip>
I think the docs for the asynchronous functions need a bit more
elaboration. For example, I had these questions after reading the
documentation:
Does the working thread block or buffer when data is available but the
main thread isn't reading it?
When the all buffers have been filled yes. I'll state that explicitely
in the docs.
The examples for byLine and byLineAsync are almost identical. Is there
any difference in functionality?
As mentioned the async version performs the request in another thread
leaving the main thread available for you to do something else. I'll
clarify in the docs that it is when you actually call empty/front on the
returned range you will get data from the other thread and may be blocking.
Is it possible to check if data is available without blocking? If not,
what's the point of byLineAsync (why not use byLine)?
No.
The .empty property needs to wait in order to have the proper range
behavior. But is does seem like a good idea to add a method for this.
Just need a nice name for it since I guess this will be needed by future
async ranges as well. Maybe range.wait(duration) returning true if data
is present after waiting?
Going down this road makes me think that selecting on async ranges would
be a very nice feature. But that is definitely not something that will
get included in the version getting reviewed now.
/Jonas