lua-users home
lua-l archive

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


On Mon, Oct 15, 2012 at 10:52:48AM -0700, Sam Roberts wrote:
> Hello Thijs,
> 
> On Mon, Oct 15, 2012 at 4:59 AM, Thijs Schreijer
> <thijs@thijsschreijer.nl> wrote:
> > I had somewhere in my mind there was a LuaSocket version that included
> > serial connections.
> 
> Its in Diego's unstable repo:
> 
> https://github.com/diegonehab/luasocket/tree/unstable
> 
> I implemented it. We use it. We never use windows.
> 
> I haven't used windows in more than a decade, but I believe that
> window's version of select only works on sockets, not on any other
> devices.
> 
> I think that luasocket's windows support is using the BSDish socket
> interface, which is easy, particularly when porting back and forth to
> unixen, but it would be more powerful if it used native windows calls,
> and IIRC the native win32 API supports asynchronous notifications

It supports asynchronous completions (i.e. a read or write of a block of
data), using a kernel-managed thread pool and callbacks. This is likely why
native SSL is implemented differently in Windows, because you can't simply
stick in an SSL transformation layer between the caller and the syscalls,
and is customary on Unix. Callbacks complicate controlling framing, among
other things.

> and waiting on multiple heterogenous object types.

The maximum is something like 64 for WaitForMultipleObjects. Which is
roughly the same magnitude as the maximum Windows supports for select(),
anyhow. Window's scaling strategy is to use threads and threaded completion
callbacks, which is not very amenable to wrapping with higher-level
abstractions. Conversely, to scale Unix requires more effort, but it's
easier to write abstractions.