How to turn off @threads for ... while debugging

I’d like to turn off (like it is nothing) @threads macro in some case while debugging. Such as I want to pass optional parameter use_threads, and then how would I modify the following code not to use threads (possibly without introducing if-then everywhere)?

@threads for i in eachidex(...)
    do something
end

Thank you very much in advance

You could create a, say, @maybethreads macro which depending on a global switch does the same thing as @threads or nothing, respectively. See @assert alternatives? - #14 by WschW for a similar example. You might also want to check out TimerOutputs.jl/README.md at master · KristofferC/TimerOutputs.jl · GitHub.