Skip to content

Commit fe474ce

Browse files
committed
update for ThreadingUtilities 0.5
1 parent 16a727d commit fe474ce

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ PolyesterWeave = "0.1"
2525
Requires = "1"
2626
Static = "0.3.3, 0.4, 0.5"
2727
StrideArraysCore = "0.2.1"
28-
ThreadingUtilities = "0.4.5"
28+
ThreadingUtilities = "0.5"
2929
julia = "1.5"
3030

3131
[extras]

src/batch.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
struct BatchClosure{F, A, B, C} # B is a Val{Bool} triggering free_local_threads!; C is a Val{Bool} triggering local storage
1+
struct BatchClosure{F, A, C} # C is a Val{Bool} triggering local storage
22
f::F
33
end
4-
function (b::BatchClosure{F,A,B,C})(p::Ptr{UInt}) where {F,A,B,C}
4+
function (b::BatchClosure{F,A,C})(p::Ptr{UInt}) where {F,A,C}
55
(offset, args) = ThreadingUtilities.load(p, A, 2*sizeof(UInt))
66
(offset, start) = ThreadingUtilities.load(p, UInt, offset)
77
(offset, stop ) = ThreadingUtilities.load(p, UInt, offset)
@@ -11,12 +11,12 @@ function (b::BatchClosure{F,A,B,C})(p::Ptr{UInt}) where {F,A,B,C}
1111
else
1212
b.f(args, (start+one(UInt))%Int, stop%Int)
1313
end
14-
# B && free_local_threads!()
14+
ThreadingUtilities._atomic_store!(p, ThreadingUtilities.SPIN)
1515
nothing
1616
end
1717

18-
@inline function batch_closure(f::F, args::A, ::Val{B}, ::Val{C}) where {F,A,B, C}
19-
bc = BatchClosure{F,A,B,C}(f)
18+
@inline function batch_closure(f::F, args::A, ::Val{C}) where {F,A,C}
19+
bc = BatchClosure{F,A,C}(f)
2020
@cfunction($bc, Cvoid, (Ptr{UInt},))
2121
end
2222

@@ -129,7 +129,7 @@ end
129129
for k 1:K
130130
add_var!(q, argt, gcpr, args[k], :args, :gcp, k)
131131
end
132-
push!(q.args, :(arguments = $argt), :(argtup = Reference(arguments)), :(cfunc = batch_closure(f!, argtup, Val{false}(), Val{$thread_local}())), gcpr)
132+
push!(q.args, :(arguments = $argt), :(argtup = Reference(arguments)), :(cfunc = batch_closure(f!, argtup, Val{$thread_local}())), gcpr)
133133
push!(q.args, nothing)
134134
q
135135
end

0 commit comments

Comments
 (0)