Thread overview
[Issue 17563] gc_inFinalizer should be public
Jun 27, 2017
ponce
Jun 30, 2017
ZombineDev
Sep 13, 2017
safety0ff.bugz
Dec 16, 2019
Dlang Bot
Dec 19, 2019
Dlang Bot
June 27, 2017
https://issues.dlang.org/show_bug.cgi?id=17563

ponce <aliloko@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aliloko@gmail.com

--- Comment #1 from ponce <aliloko@gmail.com> ---
Note: This "crude and horrible way" helped me find plenty of bugs where I would rely on the GC to release a resource, and I only do this in debug clauses so it hardly really matter how ugly it is. It's a programming error, so I make it crash right away.

--
June 30, 2017
https://issues.dlang.org/show_bug.cgi?id=17563

--- Comment #2 from Steven Schveighoffer <schveiguy@yahoo.com> ---
ponce, it's not a slight against your mechanism. It's a problem with the API. There is no reason you should have to go through the hoops of attempting to allocate memory and catching an Error, just to check the value of a global boolean. Especially when there is already a function that does just that.

--
June 30, 2017
https://issues.dlang.org/show_bug.cgi?id=17563

ZombineDev <petar.p.kirov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |petar.p.kirov@gmail.com

--
September 13, 2017
https://issues.dlang.org/show_bug.cgi?id=17563

safety0ff.bugz <safety0ff.bugz@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |safety0ff.bugz@gmail.com

--- Comment #3 from safety0ff.bugz <safety0ff.bugz@gmail.com> ---
An alternative solution worth considering is adding a parameter to destructors
(e.g. ~this(bool gcfinalizer=false)) and have the compiler handle
compatibility.

The advantage is that it is a better interface for future/alternate GC sweep implementations. For example lazy/incremental sweep, concurrent sweep would need to use thread local variables to manage the status.

--
December 16, 2019
https://issues.dlang.org/show_bug.cgi?id=17563

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@PetarKirov created dlang/druntime pull request #2873 "Fix issue 17563 - Expose gc_inFinalizer" fixing this issue:

- Fix issue 17563 - Expose gc_inFinalizer

  See the changelog entry and source code comments for details.

https://github.com/dlang/druntime/pull/2873

--
December 19, 2019
https://issues.dlang.org/show_bug.cgi?id=17563

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/druntime pull request #2873 "Fix issue 17563 - Expose gc_inFinalizer" was merged into master:

- 63d86ee3525c40984307d57fb43db8939458856b by Petar Kirov:
  Fix issue 17563 - Expose gc_inFinalizer

  See the changelog entry and source code comments for details.

https://github.com/dlang/druntime/pull/2873

--