summaryrefslogtreecommitdiff
path: root/mjit_worker.c
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-11 14:38:05 (GMT)
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-11 14:38:05 (GMT)
commit9f6e9b40d395355b678ce3bdd4d62de5dcecdfb3 (patch)
tree7cfc373bab322274aad685533832ed3766da7625 /mjit_worker.c
parent6e3fe890d5fb3c80fac41df0fa1731c27668415c (diff)
mjit_worker.c: atomically print main message and \n
To attempt to fix CI failure on rubyci freebsd: https://rubyci.org/logs/rubyci.s3.amazonaws.com/freebsd11zfs/ruby-trunk/log/20180911T123001Z.fail.html.gz ``` JIT success (68.7ms): mjit9@(eval):1 -> /usr/home/hsbt/chkbuild/tmp/build/20180911T123001Z/tmp/jit_test_unload_units_20180911-96427-13cagj9/_ruby_mjit_p99188u9.c JIT compaction (25.1ms): Compacted 10 methods -> /usr/home/hsbt/chkbuild/tmp/build/20180911T123001Z/tmp/jit_test_unload_units_20180911-96427-13cagj9/_ruby_mjit_p99188u10.soToo many JIT code -- 1 units unloaded JIT success (68.2ms): mjit10@(eval):1 -> /usr/home/hsbt/chkbuild/tmp/build/20180911T123001Z/tmp/jit_test_unload_units_20180911-96427-13cagj9/_ruby_mjit_p99188u11.c ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit_worker.c')
-rw-r--r--mjit_worker.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mjit_worker.c b/mjit_worker.c
index d0adf5d..f1404b6 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -290,11 +290,17 @@ verbose(int level, const char *format, ...)
{
if (mjit_opts.verbose >= level) {
va_list args;
+ size_t len = strlen(format);
+ char *full_format = alloca(sizeof(char) * (len + 2));
+
+ /* Creating `format + '\n'` to atomically print format and '\n'. */
+ memcpy(full_format, format, len);
+ full_format[len] = '\n';
+ full_format[len+1] = '\0';
va_start(args, format);
- vfprintf(stderr, format, args);
+ vfprintf(stderr, full_format, args);
va_end(args);
- fprintf(stderr, "\n");
}
}