On Sunday, 14 November 2021 at 12:01:36 UTC, Alexey wrote:
/home/animuspexus/dlang/d_v2.098.0/dmd/generated/linux/release/64/../../../../../phobos/std/parallelism.d(436):
 Error: need `this` for `threadFunc` of type `void()`

Go example for contrast. Ideally, I'd like something similar;

```Go
package main

import (
        "fmt"
        "time"
)

type TC struct {
}

func (self *TC) threadFunc() {
        defer fmt.Println("threadFunc done")
        time.Sleep(time.Duration(time.Second * 2))
}

func (self *TC) threadCreator() {
        defer fmt.Println("threadCreator done")
        go self.threadFunc()
}

func main() {
        defer fmt.Println("main done")
        tc := new(TC)
        tc.threadCreator()
}
```

Reply via email to