guile-devel
[Top][All Lists]
Advanced

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

Re: [Feature Request] Some ideas on 'mmap'


From: Daniel Hartwig
Subject: Re: [Feature Request] Some ideas on 'mmap'
Date: Tue, 30 Apr 2013 22:13:20 +0800

On 30 April 2013 21:49, Nala Ginrut <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]