This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
Re: Something like vector-grow available?
- To: Jost Boekemeier <jostobfe@calvados.zrz.TU-Berlin.DE>
- Subject: Re: Something like vector-grow available?
- From: Jim Blandy <jimb@red-bean.com>
- Date: 01 Aug 1999 02:31:22 -0500
- Cc: guile@sourceware.cygnus.com
- References: <199907241531.PAA03668@linux.zrz.TU-Berlin.DE> <m3zp0kp163.fsf@savonarola.red-bean.com> <p2t1zdvzq4o.fsf@grapefruit.zrz.tu-berlin.de>
> > I'm not sure how I feel about vector-grow. It seems to me that, in a
> > multi-threaded system, if the address of the vector's elements can
> > change, then you have to acquire a lock for every access to a vector
> > element, if you want to preserve the obvious semantics. Maybe someone
> > else has better ideas on how to implement this.
>
> I don't understand it. Isn't access to a vector element opaque? You
> have a vector and an index and you access a vector element by
> (vector-ref vec index) or so. But AFAIK you can't get the address of a
> vector element (at least not from scheme level).
No, at the Scheme level everything is fine. But at the C level, it
seems to me you'd need to lock the vector whenever you wanted to look
at any element. Not great for C code that scans vectors.