Behavior of `@time` when using `@spawn` (in Julia 1.8 highlights blog post)

Yes, that is correct. We can test your hypothesis by slightly modifying your example:

julia> @time begin
           t = time()
           Threads.@spawn (busywait(5); println(time() - t))
           Threads.@threads for i in 1:Threads.nthreads()
               busywait(1)
           end
       end
  2.062341 seconds (43.90 k allocations: 2.938 MiB, 3.01% compilation time)

julia> 5.037096977233887 # printed after the 5s have passed
2 Likes