Skip to content

Commit

Permalink
Fix: archetype locking issue (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
yohamta authored Aug 28, 2024
1 parent 0203c48 commit 5087bbe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion query.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,20 @@ func (q *OrderedQuery[T]) IterOrdered(w World, orderBy *ComponentType[T]) iter.S
for iter.HasNext() {
archetype := iter.Next()
archetype.Lock()
defer archetype.Unlock()

ents := archetype.Entities()
entrIter := NewOrderedEntryIterator(0, w, ents, orderBy)
for entrIter.HasNext() {
e := entrIter.Next()
if e.entity.IsReady() {
if !yield(e) {
archetype.Unlock()
return
}
}
}

archetype.Unlock()
}
}
}
Expand Down

0 comments on commit 5087bbe

Please sign in to comment.