1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +02:00

Correction to doc on Accessing Arrays from C

Thanks to Ludovic for the new wording!

* doc/ref/api-compound.texi (Accessing Arrays from C): Correct text to
  reflect the current implementation of scm_array_get_handle and
  scm_array_handle_release - which don't actuall do any dynwind stuff.
This commit is contained in:
Neil Jerram 2009-06-30 23:56:40 +01:00
parent 0a94eb002e
commit dd57ddd5ed

View file

@ -2358,21 +2358,13 @@ the danger of a deadlock. In a multi-threaded program, you will need
additional synchronization to avoid modifying reserved arrays.) additional synchronization to avoid modifying reserved arrays.)
You must take care to always unreserve an array after reserving it, You must take care to always unreserve an array after reserving it,
also in the presence of non-local exits. To simplify this, reserving even in the presence of non-local exits. If a non-local exit can
and unreserving work like a dynwind context (@pxref{Dynamic Wind}): a happen between these two calls, you should install a dynwind context
call to @code{scm_array_get_handle} can be thought of as beginning a that releases the array when it is left (@pxref{Dynamic Wind}).
dynwind context and @code{scm_array_handle_release} as ending it.
When a non-local exit happens between these two calls, the array is
implicitely unreserved.
That is, you need to properly pair reserving and unreserving in your In addition, array reserving and unreserving must be properly
code, but you don't need to worry about non-local exits. paired. For instance, when reserving two or more arrays in a certain
order, you need to unreserve them in the opposite order.
These calls and other pairs of calls that establish dynwind contexts
need to be properly nested. If you begin a context prior to reserving
an array, you need to unreserve the array before ending the context.
Likewise, when reserving two or more arrays in a certain order, you
need to unreserve them in the opposite order.
Once you have reserved an array and have retrieved the pointer to its Once you have reserved an array and have retrieved the pointer to its
elements, you must figure out the layout of the elements in memory. elements, you must figure out the layout of the elements in memory.