Skip to content

Commit

Permalink
avoid printing during finalizer
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Sep 29, 2023
1 parent 7576323 commit 1de3908
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/dataset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ Close the NCDataset `ds`. All pending changes will be written
to the disk.
"""
function Base.close(ds::NCDataset)
@debug "closing netCDF NCDataset $(ds.ncid) $(NCDatasets.path(ds))"
#@debug "closing netCDF NCDataset $(ds.ncid) $(NCDatasets.path(ds))"
try
nc_close(ds.ncid)
catch err
Expand Down
8 changes: 4 additions & 4 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ mutable struct NCDataset{TDS} <: AbstractNCDataset where TDS <: Union{AbstractNC
)

function _finalize(ds)
@debug begin
ccall(:jl_, Cvoid, (Any,), "finalize $ncid $timeid \n")
end
#@debug begin
# ccall(:jl_, Cvoid, (Any,), "finalize $ncid $timeid \n")
#end
# only close open root group
if (ds.ncid != -1) && (ds.parentdataset == nothing)
close(ds)
Expand All @@ -110,7 +110,7 @@ mutable struct NCDataset{TDS} <: AbstractNCDataset where TDS <: Union{AbstractNC
initboundsmap!(ds)
end
timeid = Dates.now()
@debug "add finalizer $ncid $(timeid)"
#@debug "add finalizer $ncid $(timeid)"
finalizer(_finalize, ds)
return ds
end
Expand Down

0 comments on commit 1de3908

Please sign in to comment.