On Sat, Aug 6, 2016 at 7:08 AM, Davide Andreoli <d...@gurumeditation.it> wrote: > 2016-08-05 18:53 GMT+02:00 Cedric BAIL <cedric.b...@free.fr>: > >> Hello, >> >> On Thu, Aug 4, 2016 at 8:34 PM, Gustavo Sverzut Barbieri >> <barbi...@gmail.com> wrote: >> > I've pushed my WIP to a branch devs/barbieri/ecore-con-eoify, see: >> > >> > https://git.enlightenment.org/core/efl.git/commit/?h=devs/ >> barbieri/ecore-con-eoify&id=35bab5c64a6c928121202697221ecebf4b606659 >> > >> > It does compile, but of course doesn't work given the implementation >> > is mostly stub (and the goal at the moment is only to define the look >> > & feel of the API). >> > >> > As requested by Tom, I've sent an example of usage (just server at the >> moment): >> > >> > https://git.enlightenment.org/core/efl.git/diff/src/ >> examples/ecore/efl_net_server_tcp.c?h=devs/barbieri/ecore-con-eoify&id= >> 35bab5c64a6c928121202697221ecebf4b606659 >> >> I think your example does illustrate quite well while asynchronous API >> with events is tricky for users to get right. I think you do set your >> error handler a little bit to late. What if during finalize the server >> is unable to listen to that port for whatever reason ? >> > > Cedric I really cannot understand your point here (as I didn't in the > promise discussion). If something goes wrong inside the constructor > then eo_add() should return NULL and the user must take care of it. > > Are you thinking at some threaded scenario? like something > can happen between the eo_add() and the callback_add() calls? > > Otherwise I cannot see how the gustavo example (with NULL > check added) can be wrong.
It doesn't need to be threaded, any of the calls in eo_add could do a callback for error, for example for trying to bind to a busy port or no more ports available or even connection dropped or just some resource not being available (not memory since we do not care about not available memory errors anyway). This an intrinsic problem of trying to use events for asynchronous operations instead of promises. The only way to circumvent it is using objects to represent operations, then register events on that and then running the operation, which would be super verbose to work with. [snip] >> -- >> Cedric BAIL Regards, -- Felipe Magno de Almeida ------------------------------------------------------------------------------ _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel