@@ -97,18 +97,20 @@ render_arg(io, arg::Base.RefValue{T}) where {T} = print(io, "Ref{", T, "}")
97
97
98
98
const HAS_CCALL_GCSAFE = VERSION >= v " 1.13.0-DEV.70"
99
99
100
- if HAS_CCALL_GCSAFE
101
- """
102
- @gcsafe_ccall ...
100
+ """
101
+ @gcsafe_ccall ...
103
102
104
- Call a foreign function just like `@ccall`, but marking it safe for the GC to run. This is
105
- useful for functions that may block, so that the GC isn't blocked from running, but may also
106
- be required to prevent deadlocks (see JuliaGPU/CUDA.jl#2261).
103
+ Call a foreign function just like `@ccall`, but marking it safe for the GC to run. This is
104
+ useful for functions that may block, so that the GC isn't blocked from running, but may also
105
+ be required to prevent deadlocks (see JuliaGPU/CUDA.jl#2261).
107
106
108
- Note that this is generally only safe with non-Julia C functions that do not call back into
109
- Julia. When using callbacks, the code should make sure to transition back into GC-unsafe
110
- mode using the `@gcunsafe` macro.
111
- """
107
+ Note that this is generally only safe with non-Julia C functions that do not call back into
108
+ Julia. When using callbacks, the code should make sure to transition back into GC-unsafe
109
+ mode using the `@gcunsafe` macro.
110
+ """
111
+ macro gcsafe_ccall end
112
+
113
+ if HAS_CCALL_GCSAFE
112
114
macro gcsafe_ccall (exprs)
113
115
exprs = pushfirst (exprs, :(gc_safe = true ))
114
116
return Base. ccall_macro_lower ((:ccall ), Base. ccall_macro_parse (exprs)... )
@@ -154,17 +156,6 @@ function ccall_macro_lower(func, rettype, types, args, nreq)
154
156
end
155
157
end
156
158
157
- """
158
- @gcsafe_ccall ...
159
-
160
- Call a foreign function just like `@ccall`, but marking it safe for the GC to run. This is
161
- useful for functions that may block, so that the GC isn't blocked from running, but may also
162
- be required to prevent deadlocks (see JuliaGPU/CUDA.jl#2261).
163
-
164
- Note that this is generally only safe with non-Julia C functions that do not call back into
165
- Julia. When using callbacks, the code should make sure to transition back into GC-unsafe
166
- mode using the `@gcunsafe` macro.
167
- """
168
159
macro gcsafe_ccall (expr)
169
160
return ccall_macro_lower (Base. ccall_macro_parse (expr)... )
170
161
end
0 commit comments