Skip to content

Commit 9619d2d

Browse files
committed
avoid running test on main thread
1 parent a0e4b3d commit 9619d2d

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

test/threads_exec.jl

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,19 +1407,25 @@ end
14071407
function construct()
14081408
Rational{I}(c)
14091409
end
1410-
prec = precision(BigFloat)
1411-
worker_count = 10 * Threads.nthreads()
1412-
task = ConcurrencyUtilities.run_concurrently_in_new_task(construct, worker_count)
1413-
schedule(task)
1414-
ok = true
1415-
while !istaskdone(task)
1416-
for _ 1:1000000
1417-
ok &= precision(BigFloat) === prec
1410+
function is_racy_rational_from_irrational()
1411+
worker_count = 10 * Threads.nthreads()
1412+
task = ConcurrencyUtilities.run_concurrently_in_new_task(construct, worker_count)
1413+
schedule(task)
1414+
ok = true
1415+
while !istaskdone(task)
1416+
for _ 1:1000000
1417+
ok &= precision(BigFloat) === prec
1418+
end
1419+
GC.safepoint()
1420+
yield()
14181421
end
1419-
GC.safepoint()
1420-
yield()
1422+
fetch(task)
1423+
ok
14211424
end
1422-
fetch(task)
1425+
prec = precision(BigFloat)
1426+
task = ConcurrencyUtilities.new_task_nonsticky(is_racy_rational_from_irrational)
1427+
schedule(task)
1428+
ok = fetch(task)
14231429
setprecision(BigFloat, prec)
14241430
ok
14251431
end

0 commit comments

Comments
 (0)