Skip to content

Commit

Permalink
[Truffle] Do not leave the lock as StringFormatter calls Ruby code (t…
Browse files Browse the repository at this point in the history
…o_s).
  • Loading branch information
eregon committed Apr 14, 2015
1 parent 40e8c62 commit 66f45f7
Showing 1 changed file with 1 addition and 8 deletions.
Expand Up @@ -1906,14 +1906,7 @@ public RubyString sprintf(Object[] args) {
final String format = args[0].toString();
final List<Object> values = Arrays.asList(args).subList(1, args.length);

final RubyThread runningThread = getContext().getThreadManager().leaveGlobalLock();

try {
// TODO(CS): this is only safe if values' toString() are pure.
StringFormatter.format(getContext(), printStream, format, values);
} finally {
getContext().getThreadManager().enterGlobalLock(runningThread);
}
StringFormatter.format(getContext(), printStream, format, values);
}

return getContext().makeString(new ByteList(outputStream.toByteArray()));
Expand Down

0 comments on commit 66f45f7

Please sign in to comment.