How to get a concurrent method?
type test struct {
foo uint8
bar uint8
}
func NewTest(arg1 string) (*test, os.Error) {...}
func (self *test) Get(str string) ([]byte, os.Error) {...}
I think that all code for method Get()
should be put inner of go func()
, and then to use a channel.
func (self *test) Get(str string) ([]byte, os.Error) {
go func() {
// Code for this method.
}()
}
- Would there be a problem if it's called another method from
Get()
? Or would it also has to be concurrent?