Issue 9606 - `std.signal` implementation is fundamentally incorrect
Summary: `std.signal` implementation is fundamentally incorrect
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 critical
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on: 4151
Blocks: 4150
  Show dependency treegraph
 
Reported: 2013-02-27 04:02 UTC by Denis Shelomovskii
Modified: 2024-12-01 16:16 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Denis Shelomovskii 2013-02-27 04:02:34 UTC
`std.signal` implementation is written like it is called from a single thread or explicitly synchronized. The reality is on objects collecting GC calls dispose events of finalizing object from its thread. So `unhook` can be called in a middle of `emit`, `connect`, or `disconnect` freezed in other thread.
Comment 1 Denis Shelomovskii 2013-02-27 04:03:21 UTC
As we can't lock GC (at least in `emit`) some sort of lock-free programming should be used here.
Comment 2 Denis Shelomovskii 2013-02-27 06:03:54 UTC
A think-less fix just to prevent nasty random failures:
https://github.com/D-Programming-Language/phobos/pull/1179
Comment 3 Denis Shelomovskii 2013-03-16 05:00:58 UTC
Added issue 4151 as a dependency as weak reference looks as the right way to fix this.
Comment 4 dlangBugzillaToGithub 2024-12-01 16:16:41 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/9956

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB