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

mlange-42 / ark / 13528862241

25 Feb 2025 07:00PM CUT coverage: 94.795% (+0.008%) from 94.787%
13528862241

push

github

web-flow
Add Map.GetRelationUnchecked (#75)

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

3406 of 3593 relevant lines covered (94.8%)

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

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

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