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

mlange-42 / ark / 13597253646

28 Feb 2025 10:03PM CUT coverage: 96.9% (-0.09%) from 96.988%
13597253646

Pull #82

github

web-flow
Merge 52c6f9ea6 into 5263582b2
Pull Request #82: Unsafe filter and query

234 of 242 new or added lines in 3 files covered. (96.69%)

17 existing lines in 1 file now uncovered.

3626 of 3742 relevant lines covered (96.9%)

50664.41 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,086✔
13
        lock := m.bitPool.Get()
1,086✔
14
        m.locks.Set(id8(lock), true)
1,086✔
15
        return lock
1,086✔
16
}
1,086✔
17

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

27
// IsLocked returns whether the world is locked by any queries.
28
func (m *lock) IsLocked() bool {
1,012,569✔
29
        return !m.locks.IsZero()
1,012,569✔
30
}
1,012,569✔
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