www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - std.signals: Error: static assert: "Aliases to mutable thread-local

reply Bagomot <bagomot gmail.com> writes:
Why can't I do it with `std.signals`? How the to do it if I can't 
create static event listeners?
```d
public void addEventListener(T : EventListener)(T listener) {
    connect(&listener.watch);
}
```
Jul 18 2022
parent reply frame <frame86 live.com> writes:
On Monday, 18 July 2022 at 10:22:16 UTC, Bagomot wrote:
 Why can't I do it with `std.signals`? How the to do it if I 
 can't create static event listeners?
 ```d
 public void addEventListener(T : EventListener)(T listener) {
    connect(&listener.watch);
 }
 ```
This error comes from somewhere else in your code by std.concurrency `spawn()`, `spawnLinked()` or `send()`.
Jul 18 2022
parent Bagomot <bagomot gmail.com> writes:
On Tuesday, 19 July 2022 at 05:24:55 UTC, frame wrote:
 On Monday, 18 July 2022 at 10:22:16 UTC, Bagomot wrote:
 Why can't I do it with `std.signals`? How the to do it if I 
 can't create static event listeners?
 ```d
 public void addEventListener(T : EventListener)(T listener) {
    connect(&listener.watch);
 }
 ```
This error comes from somewhere else in your code by std.concurrency `spawn()`, `spawnLinked()` or `send()`.
Yes. Its my error, sorry.
Jul 21 2022