need `this` on trying to use class method with parallelism Task! or task!
Alexey
animuspexus at protonmail.com
Sun Nov 14 13:43:55 UTC 2021
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()
}
```
More information about the Digitalmars-d-learn
mailing list