-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/22/2014 10:24 AM, Iñaki Baz Castillo wrote:
> Hi,
> 
> https://github.com/joyent/libuv/blob/master/src/unix/stream.c#L1389
>
>  ---------------- r = uv_write(&req, stream, bufs, nbufs,
> uv_try_write_cb); ----------------
> 
> May I understand how it is possible that such a code uses the
> address of a variable allocated in the stack (req) as function
> argument?
> 

Because it's removed from the request queue before leaving the
function, so it's safe.

> In common usage, when we attach some stuff into req->data, I
> expect that is 100% undesirable and a uv_req_t allocated in the
> heap is fully required (in order to properly access req->data in
> the uv_write_cb), am I right?
> 

This is a implementation detail of uv_try_write, if you do it and the
request is added to the queue you'll get a crash most likely.


- -- 
Saúl Ibarra Corretgé
bettercallsaghul.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iQIcBAEBAgAGBQJTViyFAAoJEEEOVVOum8BZaiIQAIuGnN3Ld67PlUf6EjY+BHxT
Nfb3i/dOQKoTr18oUiiT0WFiLc42OnrW3kcakRYWmIVeekE9OFqrF8qyYTrJs0NJ
er9oU5SRXA5dOwwzfdmiahR5gQZvhkf9QLK3+F6DNrf5SBOcpVdJQqgvdwOrKAww
ZTD7w+tdYMFx7MHSs30YEighHmxK+IeIlplciHATbXq7PKKBT4E+mKiNanR4kFRk
A/2nF+j/cpL3oPr0zYWsSz5ke4o2O7L13DyzCR/GwwHc11OUV4VGE2Bg26+Ecx7u
i0qDtp5jWwm+ztqaPoecDHWtf691HsbzWycfx0jmesJwzzjreFIqs+8o1a/J41jl
FFMRRT6taL3/w29Tbq6qFOpgJxekE2hTE0RsuhTd1lwXPH/iHsKfjHr2FRIPnmTH
p8PvSyHfb75hYTYInhL5SCKYaq9fEbkSy5sJTQD59/5KCt2ogJoe6kVjjtsCWhoS
LPB4tnDZFrJ0eKESC5zynz9Afq37RBOhMshWLectEt66pRHyMFSZP3kmhTDzrOjy
UzeIuTWPUe4YM7JYO9svSDF28xf0HOxK7q/C+/tcrU4RIZqlg5wutdUem6TM+FsA
z+LwZ175m4Sk25V2RyMRxRC8bOkhOXyk76ZCVHc5sWiFV8eiXM5ow6DlTV8Jg1AI
2tK+0HVgJr2fMkYpbVK5
=etQC
-----END PGP SIGNATURE-----

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to