Skip to content

Commit

Permalink
avoid running test on main thread
Browse files Browse the repository at this point in the history
  • Loading branch information
nsajko committed Jan 29, 2025
1 parent 5bae375 commit 367add1
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions test/threads_exec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1407,19 +1407,25 @@ end
function construct()
Rational{I}(c)
end
prec = precision(BigFloat)
worker_count = 10 * Threads.nthreads()
task = ConcurrencyUtilities.run_concurrently_in_new_task(construct, worker_count)
schedule(task)
ok = true
while !istaskdone(task)
for _ 1:1000000
ok &= precision(BigFloat) === prec
function is_racy_rational_from_irrational()
worker_count = 10 * Threads.nthreads()
task = ConcurrencyUtilities.run_concurrently_in_new_task(construct, worker_count)
schedule(task)
ok = true
while !istaskdone(task)
for _ 1:1000000
ok &= precision(BigFloat) === prec
end
GC.safepoint()
yield()
end
GC.safepoint()
yield()
fetch(task)
ok
end
fetch(task)
prec = precision(BigFloat)
task = ConcurrencyUtilities.new_task_nonsticky(is_racy_rational_from_irrational)
schedule(task)
ok = fetch(task)
setprecision(BigFloat, prec)
ok
end
Expand Down

0 comments on commit 367add1

Please sign in to comment.