Is there a barrier synchronization primitive to synchronize multiple threads created by @threads
and ensure that they all reach a certain point in a for loop before continuing execution. Such as below?
barrier = Threads.Barrier(nthreads())
@threads for i in 1:nthreads()
for j in 1:10
# do some work
# wait for other threads to reach the barrier
Threads.wait(barrier)
# do some more work
end
end