You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
371 B
21 lines
371 B
package hal
|
|
|
|
type MultiThreadedIO struct {
|
|
channel chan float64
|
|
}
|
|
|
|
func NewMultiThreadedIO() *MultiThreadedIO {
|
|
return &MultiThreadedIO{
|
|
channel: make(chan float64),
|
|
}
|
|
}
|
|
|
|
func (io *MultiThreadedIO) Read() (float64, error) {
|
|
result := <-io.channel
|
|
return result, nil
|
|
}
|
|
|
|
func (io *MultiThreadedIO) Write(content float64) error {
|
|
io.channel <- content
|
|
return nil
|
|
}
|
|
|