-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopData.go
45 lines (36 loc) · 915 Bytes
/
opData.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package muSupervisor
import "time"
type opType int
type opState int
//go:generate stringer -type=opType
const (
LOCK opType = iota
UNLOCK
RLOCK
RUNLOCK
)
//go:generate stringer -type=opState
const (
PENDING opState = iota
ACTIVE
DONE
DONERWAIT // Read unlocked but waiting for all other read locks to be gone
)
type routineNum uint64
//TODO: split opData with reqData. See the TODO in supervisedMutex.go
// The distinction is
// Operation: a cycle of LOCK, OBTAIN, UNLOCK operations for a mutex
// Request: the single LOCK/UNLOCK request
// opData represents the specific lock/unlock operation for a request.
type opData struct {
t opType
numRoutine routineNum
mutexPtr *supervisedMutex
reqTime time.Time
state opState
stackTrace *string
alreadyLogged bool
}
// reqData represents one of the requests for a mutex (which may have more than one op)
type reqData struct {
}