On Sat, Jun 26, 2021 at 2:09 AM Renato Maia <maia.ren...@gmail.com> wrote:
>
> In libuv v1.x (963ecc82) in Windows 10, I noticed that 'uv_read_start'
> over a 'uv_tty_t' calls the 'uv_alloc_cb' before it returns. The same
> does not seem to happen in Linux, nor even in Windows if we use other
> 'uv_tcp_t' ir 'uv_pipe_t'. Is this expected?
>
> It was a problem for me because my code only sets up the environment
> for the callback if 'uv_read_start' returns successfully (err >= 0).
> Also, from the way the general design of the event loop of libuv is
> described (http://docs.libuv.org/en/v1.x/design.html), I was surprised
> that callbacks can be invoked inside an API call.
>
> I attached a small example to reproduce this scenario. On Linux, it
> works as expected:
>
> ```
> libuv_ttyinlineread.c:38:main(server started!)
> I type this line
> libuv_ttyinlineread.c:14:on_alloc(size=65536)
> libuv_ttyinlineread.c:9:on_read(nread=17)
> ```
>
> But on Windows 10, I get this:
>
> ```
> libuv_ttyinlineread.c:14:on_alloc(size=8192)
> Assertion failed: handle->data, file libuv_ttyinlineread.c, line 15
> ```
>
> Thanks in advance.
>
> --
> Renato Maia

Yes, that's expected. Libuv sometimes has to commit memory upfront.

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to libuv+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/libuv/CAHQurc9rxJr6Cfj%3D8EpuYBofEpOhe3aM2-GuJew9r6m3WgUPrg%40mail.gmail.com.

Reply via email to