Skip to content

Commit 98944d5

Browse files
committed
clean up test a little
1 parent c3a8fac commit 98944d5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/test_database.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,11 @@ def test_function_gc_segfault
283283
@db.create_function("bug", -1) { |func, *values| func.result = values.join }
284284
# With a lot of data and a lot of threads, try to induce a GC segfault.
285285
params = Array.new(127, "?" * 28000)
286-
proc = Proc.new { db.execute("select bug(#{Array.new(params.length, "?").join(",")})", params) }
287-
Mutex.new.tap { |m| threads = (0..30).inject([]) { |a| a << Thread.new { m.synchronize { proc.call } } }.each { |thread| thread.join } }
286+
proc = Proc.new {
287+
db.execute("select bug(#{Array.new(params.length, "?").join(",")})", params)
288+
}
289+
m = Mutex.new
290+
threads = 30.times.map { Thread.new { m.synchronize { proc.call } } }.each(&:join)
288291
end
289292

290293
def test_function_return_type_round_trip

0 commit comments

Comments
 (0)