func NewSyncedReadCloser(r io.ReadCloser) *SyncedReadCloser {
	var (
		s   SyncedReadCloser
		err error
	)
	s.data, err = ioutil.ReadAll(r)
	if err != nil {
		return nil
	}
	r.Close()
	s.length = int64(len(s.data))
	s.opengate = make(chan struct{})
	s.enableBlocking = true
	return &s
}
NewSyncedReadCloser creates a new SyncedReadCloser instance.
package race
import (
	"fmt"
	"io"
	"io/ioutil"
	"time"
)
type SyncedReadCloser struct {
	data           []byte
	p              int64
	length         int64
	opengate       chan struct{}
	enableBlocking bool
}