mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Do not run File.write while Ractors are running
also make sure all local variables have the __bmdv_ prefix.
This commit is contained in:
parent
27382eb9fc
commit
a0216b1acf
1 changed files with 15 additions and 12 deletions
|
@ -66,29 +66,32 @@ Warning[:experimental] = false
|
||||||
#{prelude}
|
#{prelude}
|
||||||
|
|
||||||
if #{loop_count} == 1
|
if #{loop_count} == 1
|
||||||
__bmdv_empty_before = 0
|
__bmdv_loop_before = 0
|
||||||
__bmdv_empty_after = 0
|
__bmdv_loop_after = 0
|
||||||
else
|
else
|
||||||
__bmdv_empty_before = Time.new
|
__bmdv_loop_before = Time.new
|
||||||
#{while_loop('', loop_count, id: 0)}
|
#{while_loop('', loop_count, id: 0)}
|
||||||
__bmdv_empty_after = Time.new
|
__bmdv_loop_after = Time.new
|
||||||
end
|
end
|
||||||
|
|
||||||
ractors = []
|
__bmdv_ractors = []
|
||||||
<% results.each do |result| %>
|
<% results.size.times do %>
|
||||||
ractors << Ractor.new(__bmdv_empty_after - __bmdv_empty_before) { |loop_time|
|
__bmdv_ractors << Ractor.new(__bmdv_loop_after - __bmdv_loop_before) { |__bmdv_loop_time|
|
||||||
__bmdv_time = Time
|
__bmdv_time = Time
|
||||||
__bmdv_script_before = __bmdv_time.new
|
__bmdv_script_before = __bmdv_time.new
|
||||||
#{while_loop(script, loop_count, id: 1)}
|
#{while_loop(script, loop_count, id: 1)}
|
||||||
__bmdv_script_after = __bmdv_time.new
|
__bmdv_script_after = __bmdv_time.new
|
||||||
|
|
||||||
File.write(
|
(__bmdv_script_after - __bmdv_script_before) - __bmdv_loop_time
|
||||||
<%= result.dump %>,
|
|
||||||
((__bmdv_script_after - __bmdv_script_before) - loop_time).inspect,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
<% end %>
|
<% end %>
|
||||||
ractors.each(&:take)
|
|
||||||
|
# Wait for all Ractors before executing code to write results
|
||||||
|
__bmdv_ractors.map!(&:take)
|
||||||
|
|
||||||
|
<% results.each do |result| %>
|
||||||
|
File.write(<%= result.dump %>, __bmdv_ractors.shift)
|
||||||
|
<% end %>
|
||||||
|
|
||||||
#{teardown}
|
#{teardown}
|
||||||
RUBY
|
RUBY
|
||||||
|
|
Loading…
Reference in a new issue