Skip to content

Commit 77729b4

Browse files
nthreads/maxthreadid depending on Julia version
1 parent 7b0d76f commit 77729b4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/search.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ function search(graph::G,
2222
# lists of candidates, sorted by distance
2323
candidates = [BinaryMaxHeap{Tuple{U, V, Bool}}() for _ in 1:length(queries)]
2424
# a set of seen candidates per thread
25-
seen_sets = [BitVector(undef, length(data)) for _ in 1:Threads.maxthreadid()]
25+
max_threads = @static VERSION >= v"1.9.0" ? Threads.maxthreadid() : Threads.nthreads()
26+
seen_sets = [BitVector(undef, length(data)) for _ in 1:max_threads]
2627
Threads.@threads :static for i in eachindex(queries) # :static needed to use threadid()
2728
# zero out seen
2829
seen = seen_sets[Threads.threadid()]

0 commit comments

Comments
 (0)