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
2
2
f:: F
3
3
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}
5
5
(offset, args) = ThreadingUtilities. load (p, A, 2 * sizeof (UInt))
6
6
(offset, start) = ThreadingUtilities. load (p, UInt, offset)
7
7
(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}
11
11
else
12
12
b. f (args, (start+ one (UInt))% Int, stop% Int)
13
13
end
14
- # B && free_local_threads!( )
14
+ ThreadingUtilities . _atomic_store! (p, ThreadingUtilities . SPIN )
15
15
nothing
16
16
end
17
17
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)
20
20
@cfunction ($ bc, Cvoid, (Ptr{UInt},))
21
21
end
22
22
129
129
for k ∈ 1 : K
130
130
add_var! (q, argt, gcpr, args[k], :args , :gcp , k)
131
131
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)
133
133
push! (q. args, nothing )
134
134
q
135
135
end
0 commit comments