guile-devel
[Top][All Lists]
Advanced

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

Re: array handles and non-local exits


From: Andy Wingo
Subject: Re: array handles and non-local exits
Date: Mon, 06 Jul 2009 15:09:24 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Hi,

On Sun 05 Jul 2009 12:14, address@hidden (Ludovic Courtès) writes:

> Andy Wingo <address@hidden> writes:
>
>> I'm hacking on this code right now, and have come to think that
>> scm_array_handle_release is superfluous. It shouldn't protect against
>> concurrent modification of the data, as that should be done with
>> user-implemented mutexen. It obviously doesn't do anything now -- and
>> really, it doesn't have anything to do. I can't think of a /supported/
>> modification of an array that will leave a pointer to the elements
>> invalid -- i.e. we have no truncation ops that I know of.
>
> How about copy-on-write stringbufs as produced by `substring'?  I
> suppose it's only a problem is the stringbuf is accessed concurrently,
> though.

Good question. I suppose you have this case in mind:

  (define s0 (string "foooooo"))
  (define s1 (substring/shared s0 0))
  (define s2 (substring/shared s1 0))
  (par-for-each (lambda (s) (string-set! s 0 #\b))
                (list s0 s1 s2))

I suppose that's a case in which scm_array_handle_elements and
scm_array_handle_writable_elements should do different things. But once
you have the array handle, it doesn't seem that it needs to be released.
(The validity of the pointer should be assured by the reference that
each string has to its stringbuf.)

Andy
-- 
http://wingolog.org/




reply via email to

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