mirror of
https://github.com/zhengkai/orca.git
synced 2026-02-12 13:42:25 +08:00
up
This commit is contained in:
38
server/src/core/row.go
Normal file
38
server/src/core/row.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"project/pb"
|
||||
"project/zj"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type row struct {
|
||||
hash [16]byte
|
||||
req *pb.Req
|
||||
rsp []byte
|
||||
err error
|
||||
done bool
|
||||
t time.Time
|
||||
mux sync.RWMutex
|
||||
}
|
||||
|
||||
func (pr *row) run() {
|
||||
|
||||
pr.t = time.Now()
|
||||
|
||||
s := fmt.Sprintf(`%x, %s`, pr.hash, pr.t.Format(`2006-01-02 15:04:05`))
|
||||
zj.J(`new`, s)
|
||||
|
||||
pr.rsp = []byte(s)
|
||||
pr.done = true
|
||||
pr.mux.Unlock()
|
||||
}
|
||||
|
||||
func (pr *row) wait() {
|
||||
if !pr.done {
|
||||
pr.mux.RLock()
|
||||
pr.mux.RUnlock()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user