[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: selecting sockets and serials
- From: Coda Highland <chighland@...>
- Date: Mon, 15 Oct 2012 16:00:34 -0700
On Mon, Oct 15, 2012 at 3:40 PM, William Ahern
<william@25thandclement.com> wrote:
> 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.
>
>
For the record, Qt manages to succeed at the abstraction rather well,
although it does this by abstracting away the select() call too and
using callbacks on UNIX as well as Windows. (But it's the same
dispatch mechanism that Qt uses for everything else, so it's very
natural.)
/s/ Adam