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

mlange-42 / ark / 13593764975

28 Feb 2025 05:59PM CUT coverage: 96.655% (+1.9%) from 94.795%
13593764975

Pull #79

github

web-flow
Merge 09719939d into 10315654e
Pull Request #79: Relation getters for queries and maps

118 of 118 new or added lines in 6 files covered. (100.0%)

8 existing lines in 1 file now uncovered.

3554 of 3677 relevant lines covered (96.65%)

50773.12 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,002,350✔
29
        return !m.locks.IsZero()
1,002,350✔
30
}
1,002,350✔
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