Re: [dev] Suckless remote shell?
* Alexander S. <alex0player_AT_gmail.com> [2013-11-07 16:55:35 +0400]:
> Context pointers for callbacks... well, they exist because of the
> limitations of the type system. I'd rather see
> ?A,[Types...].pthread_create(pthread_t*, A(*callback)(Types...), Types
> args...) (so, arbitrarily many additional args for callbacks). A
> type-checker can properly check it, and even in current calling
> conventions, it's quite fast to handle: you just copy a chunk of
> memory fro and to stack, wholesale. Failing that, there's always
> ?A,B.pthread_create(pthread_t*, A(*callback)(B), B arg).
with a single pointer arg this assumes that all pointers have
the same representation or that you create a separate version
of pthread_create for every type used
arbitrary number of args does not work: you need runtime type
information for that (which is complex, slow and problematic
to define the binary interface), var arg calls are not just
passing a chunk of memory on the stack (would be suboptimal
on archs like x86_64 with lot of registers)
> mmap is another matter, but whether for turning file into RAM or for
> IPC, it tends to have some structure, I guess?
you can allocate memory with mmap and reuse it several times for
different type of objects or you may need to parse the mmaped
data so you don't know static types
Received on Thu Nov 07 2013 - 16:16:12 CET
This archive was generated by hypermail 2.3.0
: Thu Nov 07 2013 - 16:24:07 CET