• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mlange-42 / ark / 13605138694

01 Mar 2025 01:11PM CUT coverage: 97.11% (+0.09%) from 97.025%
13605138694

Pull #83

github

web-flow
Merge 8eaf83192 into 3013a616a
Pull Request #83: Add functionality required for (de)-serialization

112 of 113 new or added lines in 4 files covered. (99.12%)

3831 of 3945 relevant lines covered (97.11%)

47707.19 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.47
/ecs/lock.go
1
package ecs
2

3
// Manages locks by mask bits.
4
//
5
// The number of simultaneous locks at a given time is limited to [MaskTotalBits].
6
type lock struct {
7
        locks   Mask    // The actual locks.
8
        bitPool bitPool // The bit pool for getting and recycling bits.
9
}
10

11
// Lock the world and get the Lock bit for later unlocking.
12
func (m *lock) Lock() uint8 {
1,097✔
13
        lock := m.bitPool.Get()
1,097✔
14
        m.locks.Set(id8(lock), true)
1,097✔
15
        return lock
1,097✔
16
}
1,097✔
17

18
// Unlock unlocks the given lock bit.
19
func (m *lock) Unlock(l uint8) {
1,098✔
20
        if !m.locks.Get(id8(l)) {
1,099✔
21
                panic("unbalanced unlock. Did you close a query that was already iterated?")
1✔
22
        }
23
        m.locks.Set(id8(l), false)
1,097✔
24
        m.bitPool.Recycle(l)
1,097✔
25
}
26

27
// IsLocked returns whether the world is locked by any queries.
28
func (m *lock) IsLocked() bool {
1,012,439✔
29
        return !m.locks.IsZero()
1,012,439✔
30
}
1,012,439✔
31

32
// Reset the locks and the pool.
33
func (m *lock) Reset() {
×
34
        m.locks = Mask{}
×
35
        m.bitPool.Reset()
×
36
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc