On 13-Jan-08, at 5:38 AM, David Rush wrote:
On Jan 13, 2008 3:37 AM, Marc Feeley feeley@iro.umontreal.ca wrote:
On 12-Jan-08, at 8:07 PM, David Rush wrote: If all you need is to interface to read(), why don't you use read- subu8vector? For example:
Because as soon as you start in on FFI coding (read's not the only thing - but it is the main thing) you start to assume that that is where your answers will all lie?
Sorry but I don't follow. I was under the impression that your problem was doing fast I/O, and for that you can use Gambit's bulk-I/O procedures.
Thanks for the tip. As a side note where did you get the magic numbers in the code:
(define subtype-s8vector 20) (define subtype-u8vector 21)
Since they look like internal tag values, I'd be worried about using this mechanism in the general case...
You can get the tag values (and many other internal definitions) from the file ~~/lib/_gambit#.scm using the macros macro-subtype-u8vector, etc. For example:
(include "~~/lib/_gambit#.scm")
(define subtype-s8vector (macro-subtype-s8vector)) (define subtype-u8vector (macro-subtype-u8vector))
Marc
Afficher les réponses par date
On 13-Jan-08, at 5:38 AM, David Rush wrote:
Because as soon as you start in on FFI coding (read's not the only thing - but it is the main thing) you start to assume that that is where your answers will all lie?
Don't forget that if you can do it, using read-subu8vector instead of the C library or POSIX read routines would give the benefit of integrating well into Gambit's multithreading.
(The possible alternative for achieving the same thing being using the libevent patch Adam Langley posted some time ago, and using libevent instead of the C library/POSIX read routines in the C code. Or, yet another alternative, run the FCGI stuff in separate pthread's and use posix pipes for synchronization between C and Gambit (needs registration of the Gambit's pipe ends in the Gambit runtime), ask for details if you want to do this.)
Christian.
(*) https://webmail.iro.umontreal.ca/pipermail/gambit-list/2005-August/000367.ht...