Skip to content

Commit d852de8

Browse files
authored
Merge pull request #108 from JuliaDebug/teh/fix_106
Run all Base users of `sigatomic` in compiled mode. Fixes #106
2 parents f92487c + 94f8834 commit d852de8

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/JuliaInterpreter.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,10 @@ function set_compiled_methods()
11451145
push!(compiled_methods, which(unsafe_store!, (Ptr, Any, Int)))
11461146
# issue #92
11471147
push!(compiled_methods, which(objectid, Tuple{Any}))
1148+
# issue #106 --- anything that uses sigatomic_(begin|end)
1149+
push!(compiled_methods, which(flush, Tuple{IOStream}))
1150+
push!(compiled_methods, which(disable_sigint, Tuple{Function}))
1151+
push!(compiled_methods, which(reenable_sigint, Tuple{Function}))
11481152
end
11491153

11501154
function __init__()

test/interpret.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,25 @@ end
295295
@interpret f98()
296296
@test x98 == 7
297297

298+
# issue #106
299+
function f106()
300+
n = tempname()
301+
w = open(n, "a")
302+
write(w, "A")
303+
flush(w)
304+
return true
305+
end
306+
@test @interpret(f106()) == 1
307+
f106b() = rand()
308+
f106c() = disable_sigint(f106b)
309+
function f106d()
310+
disable_sigint() do
311+
reenable_sigint(f106b)
312+
end
313+
end
314+
@interpret f106c()
315+
@interpret f106d()
316+
298317
# Some expression can appear nontrivial but lower to nothing
299318
@test isa(JuliaInterpreter.prepare_thunk(Main, :(@static if ccall(:jl_get_UNAME, Any, ()) == :NoOS 1+1 end)), Nothing)
300319
@test isa(JuliaInterpreter.prepare_thunk(Main, :(Base.BaseDocs.@kw_str "using")), Nothing)

0 commit comments

Comments
 (0)