lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Oliver once stated:
> On 09.02.20 00:49, Dibyendu Majumdar wrote:
> > As I mentioned earlier in the chain, libuv's great strength it is used
> > in projects like Node.Js and Julia and therefore really battle tested
> > by large numbers of companies and people. Even if you dislike the
> > framework (and some people might dislike it as it builds objects in C
> > and requires really difficult event driven programming) - it is hard
> > to see how a replacement library could be justified.
> 
> yes, I agree, it's hard to justify, but from from an aesthetic point of view I
> would prefer a solution with several platform specific low level Lua C bindings
> to the platform specific APIs select/IOCP etc. and a complexer Lua library above
> these bindings that does the platform abstraction.

  "Complexer?"

  Okay, given the two ways of doing events:

	Ask when the operation can start (POSIX)
	Ask when the operation is finished (IOCP)

then that means two different event libraries.  I'm looking over my own
event framework, and I think I identified the two locations where this
distinction can be made---one for TCP [1] and one for TLS [2], and it would
be fairly easy to rework the code for POSIX of IOCP style operations.

  The _refill() function exists to read data from the underlying socket, and
_drain() to write data to the underlying socket.  So modifying those two,
plus the event handler (the unnamed function being returned) is all that's
required (I suspect).  But I have no real way to test this at this time.

  -spc

[1] https://github.com/spc476/lua-conmanorg/blob/50dc10fb23cccf1d9c17541a2c917e4916f800e5/lua/nfl/tcp.lua#L49

[2] https://github.com/spc476/lua-conmanorg/blob/50dc10fb23cccf1d9c17541a2c917e4916f800e5/lua/nfl/tls.lua#L47