threadsafe access to scm_ptobs
authorAndy Wingo <wingo@pobox.com>
Mon, 7 Nov 2011 17:58:01 +0000 (18:58 +0100)
committerAndy Wingo <wingo@pobox.com>
Mon, 7 Nov 2011 17:58:01 +0000 (18:58 +0100)
commit62bd5d66cb66b695452887374c55d025b8b6efea
tree227dae36a713e1881a6f90a63dba9ec684f88fd0
parenta535e9f54c35bb90bfa272ed040fe71825ce03dd
threadsafe access to scm_ptobs

* libguile/ports.h (SCM_PORT_DESCRIPTOR): New macro, to get at a port
  descriptor in the third word of a port instead of looking it up in a
  table.
  (scm_c_port_type_ref, scm_c_port_type_add_x): New API for working with
  numbered ptob descriptors.
  (SCM_PTOBNAME): Implement in terms of scm_c_port_type_ref.
  (scm_get_byte_or_eof, scm_peek_byte_or_eof): Use SCM_PORT_DESCRIPTOR.

* libguile/ports.c (scm_c_num_port_types, scm_c_port_type_ref)
  (scm_c_port_type_add_x, scm_make_port_type): Protect scm_ptobs access
  with a mutex.  Have it be an array of pointers instead of an array of
  structures.  Adapt users to the new APIs.
  (scm_c_make_port_with_encoding): Allocate ports with three words.  The
  third word is the ptob descriptor.

* libguile/backtrace.c:
* libguile/goops.c:
* libguile/ioext.c:
* libguile/print.c: Adapt to use scm_c_port_type_ref and
  SCM_PORT_DESCRIPTOR.
libguile/backtrace.c
libguile/goops.c
libguile/ioext.c
libguile/ports.c
libguile/ports.h
libguile/print.c