summaryrefslogtreecommitdiff
path: root/byterun/extern.c
diff options
context:
space:
mode:
Diffstat (limited to 'byterun/extern.c')
-rw-r--r--byterun/extern.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/byterun/extern.c b/byterun/extern.c
index d0c7c4c4fc..8ad3a76ef3 100644
--- a/byterun/extern.c
+++ b/byterun/extern.c
@@ -391,12 +391,18 @@ static long extern_value(value v, value flags)
void output_val(struct channel *chan, value v, value flags)
{
long len;
+ char * block;
+
if (! channel_binary_mode(chan))
failwith("output_value: not a binary channel");
alloc_extern_block();
len = extern_value(v, flags);
+ /* During really_putblock, concurrent output_val operations can take
+ place (via signal handlers or context switching in systhreads),
+ and extern_block may change. So, save the pointer in a local variable. */
+ block = extern_block;
really_putblock(chan, extern_block, len);
- stat_free(extern_block);
+ stat_free(block);
}
value output_value(value vchan, value v, value flags) /* ML */