diff options
author | Andy Wingo <wingo@pobox.com> | 2011-11-08 00:46:41 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-11-08 00:55:06 +0100 |
commit | f209aeee9fc5032863cc07138be927da87d3a091 (patch) | |
tree | e8c4e1e701bc9081d5119613e1cf2a338daba601 /libguile/ports.c | |
parent | 0607ebbfcf63dc81e4bc2b10f3a8c3bc0d348c09 (diff) | |
download | guile-f209aeee9fc5032863cc07138be927da87d3a091.tar.gz |
locking for write, lfwrite
* libguile/ports.c (scm_c_write_unlocked, scm_c_write)
(scm_lfwrite_unlocked, scm_lfwrite): Add locking and _unlocked
variants. Change uses to _unlocked.
Diffstat (limited to 'libguile/ports.c')
-rw-r--r-- | libguile/ports.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/libguile/ports.c b/libguile/ports.c index 394d4c137..a95774b31 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -2174,7 +2174,7 @@ scm_puts (const char *s, SCM port) * Warning: Doesn't update port line and column counts! */ void -scm_c_write (SCM port, const void *ptr, size_t size) +scm_c_write_unlocked (SCM port, const void *ptr, size_t size) #define FUNC_NAME "scm_c_write" { scm_t_port *pt; @@ -2195,12 +2195,20 @@ scm_c_write (SCM port, const void *ptr, size_t size) } #undef FUNC_NAME +void +scm_c_write (SCM port, const void *ptr, size_t size) +{ + scm_c_lock_port (port); + scm_c_write_unlocked (port, ptr, size); + scm_c_unlock_port (port); +} + /* scm_lfwrite * * This function differs from scm_c_write; it updates port line and * column. */ void -scm_lfwrite (const char *ptr, size_t size, SCM port) +scm_lfwrite_unlocked (const char *ptr, size_t size, SCM port) { scm_t_port *pt = SCM_PTAB_ENTRY (port); scm_t_ptob_descriptor *ptob = SCM_PORT_DESCRIPTOR (port); @@ -2217,6 +2225,14 @@ scm_lfwrite (const char *ptr, size_t size, SCM port) pt->rw_active = SCM_PORT_WRITE; } +void +scm_lfwrite (const char *ptr, size_t size, SCM port) +{ + scm_c_lock_port (port); + scm_lfwrite_unlocked (ptr, size, port); + scm_c_unlock_port (port); +} + /* Write STR to PORT from START inclusive to END exclusive. */ void scm_lfwrite_substr (SCM str, size_t start, size_t end, SCM port) |