On 09/10/2016 12:46 PM, Bernardo Ramos wrote: > Hi guys! > > I have a suggestion for v2: > > To change the uv_async_send() to contain a queue inside it so we don't > need to implement it in our code. > > In this way we could just call uv_async_send() and the callback would be > fired in the main (or other) event loop with the dequeued pointer from > the queue. > > I guess it would be much easier for the libuv users as we would not have > to care about creating a queue, using mutexes and even about the > coalescing of calls. All this could be handled automatically by libuv. > > What do you think about this? > > Maybe in the future it could even have a lock-free approach to this > instead of using a mutex to avoid deadlocks, using *lib*lfds.org or > other library (Well, I know this is a dangerous zone. We can just use > mutexes for now). > > Also, if the queue has a limited size and it is full then function > should either block until succeeded or return an error. > > What is better, let it the way it is or make it easier to use? >
Hi, I had some other idea a while ago, which I described here: https://github.com/libuv/leps/pull/2 (search for uv_callback_t). The end goal is the same: have a way to queue a callback from another thread without coalescing, but the difference being what the user sent was a request. I don't think what you suggest would help many, because uv_async_send just calls the callback, so if we wouldn't coalesce calls you'd get the callback called N times, but no data can be associated with each call. Hence my proposal. Alas, I think I packed too many things in a single LEP and it stalled. I should probably break it into smaller pieces so we move forward / discard them. Cheers, -- Saúl Ibarra Corretgé bettercallsaghul.com -- 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 https://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: OpenPGP digital signature
