On 30 April 2013 21:49, Nala Ginrut <nalagin...@gmail.com> wrote:
>> > 6. other helper functions also available:
>>
>> If you want a port, use a port.  Likewise for strings, bytevectors.
>>
>
> For an instance, in a multi-thread program, if we use port and need to
> move the cursor, we have to remember/restore the cursor for other
> threads. But if we use mmap, we don't have to do that, each thread keeps
> their own pointer/index.
> And why not read them all into a bytevector? Yes, it helps, but as I
> explained, the very big file.
>

After mmap you have a pointer.  You can make any number of ports from
that pointer, each thread can just have its own port if that behaviour
is desired.

The useful information from mmap is a pointer.  There are already
procedures in place to wrap other datatypes/interface around pointers,
for example:

(define ptr (mmap arg ...))
(define port (open-bytevector-input-port (pointer->bytevector ptr len)))

No need to duplicate any of port, string, etc. interfaces.

Regards

Reply via email to