JuliaTime / TimeZones.jl

IANA time zone database access for the Julia programming language
Other
86 stars 51 forks source link

`TimeZones.TZData.compile()` fails on Julia 1.9.0-rc3 #430

Closed kpamnany closed 1 year ago

kpamnany commented 1 year ago

Due to https://github.com/JuliaLang/julia/pull/49094, the interactive thread(s) (if you start any) are now thread 1 (and up) and the default threads start after that. That breaks this assertion, which I don't think is necessary anyway?

I think this can be fixed with something like:

function empty_thread_local_caches(both_pools = true)
    tp = Threads.threadpool()
    Threads.@threads :static for i in 1:Threads.nthreads(tp)
        empty!(_tz_cache())
    end
    !both_pools && return
    if tp == :default
        if Threads.nthreads(:interactive) > 0
            fetch(@spawn :interactive empty_thread_local_caches(false))
        end
    else
        fetch(@spawn :default empty_thread_local_caches(false))
    end
end

Also, since this package uses thread-local data, you probably want to use maxthreadid() here instead of nthreads().

omus commented 1 year ago

Fixed by #382