1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-29 22:40:34 +02:00

Remove port locks

* libguile/ports.h (scm_t_port): Remove lock field.
  (scm_dynwind_lock_port, scm_c_lock_port, scm_c_try_lock_port):
  Remove.
* libguile/ports.c (scm_i_port_property, scm_i_set_port_property_x):
  Remove locking.
* libguile/ports.c (scm_c_make_port_with_encoding): Remove lock.
  (scm_i_read_bytes, scm_i_read, scm_i_write_bytes, scm_i_write): Remove
  "_unlocked" from names and adapt callers.
This commit is contained in:
Andy Wingo 2016-04-28 08:34:08 +02:00
parent 8b46a4af44
commit 2b47043052
2 changed files with 22 additions and 99 deletions

View file

@ -84,9 +84,6 @@ typedef struct
/* Link back to the port object. */
SCM port;
/* A recursive lock for this port. */
scm_i_pthread_mutex_t *lock;
/* Pointer to internal-only port structure. */
struct scm_port_internal *internal;
@ -289,11 +286,6 @@ SCM_API SCM scm_set_port_encoding_x (SCM port, SCM encoding);
SCM_API SCM scm_port_conversion_strategy (SCM port);
SCM_API SCM scm_set_port_conversion_strategy_x (SCM port, SCM behavior);
/* Acquiring and releasing the port lock. */
SCM_API void scm_dynwind_lock_port (SCM port);
SCM_INLINE int scm_c_lock_port (SCM port, scm_i_pthread_mutex_t **lock);
SCM_INLINE int scm_c_try_lock_port (SCM port, scm_i_pthread_mutex_t **lock);
/* Input. */
SCM_API int scm_get_byte_or_eof (SCM port);
SCM_API int scm_peek_byte_or_eof (SCM port);
@ -363,36 +355,6 @@ SCM_API SCM scm_sys_make_void_port (SCM mode);
SCM_INTERNAL void scm_init_ports (void);
/* Inline function implementations. */
#if SCM_CAN_INLINE || defined SCM_INLINE_C_IMPLEMENTING_INLINES
SCM_INLINE_IMPLEMENTATION int
scm_c_lock_port (SCM port, scm_i_pthread_mutex_t **lock)
{
*lock = SCM_PTAB_ENTRY (port)->lock;
if (*lock)
return scm_i_pthread_mutex_lock (*lock);
else
return 0;
}
SCM_INLINE_IMPLEMENTATION int
scm_c_try_lock_port (SCM port, scm_i_pthread_mutex_t **lock)
{
*lock = SCM_PTAB_ENTRY (port)->lock;
if (*lock)
{
int ret = scm_i_pthread_mutex_trylock (*lock);
if (ret != 0)
*lock = NULL;
return ret;
}
else
return 0;
}
#endif /* SCM_CAN_INLINE || defined SCM_INLINE_C_IMPLEMENTING_INLINES */
#endif /* SCM_PORTS_H */
/*