Opened 10 years ago

Closed 10 years ago

#2398 closed defect (wontfix)

[PATCH] thread notifications and list sorting

Reported by: _db_ Owned by:
Priority: Should Have Milestone:
Component: Core engine Keywords: patch
Cc: Patch:

Description

Stumbled about these ones:

  1. UserReport thread is notified every frame, just to be sent back to sleep.

=> Added check before notification, so thread continues to sleep if nothing to do.

  1. Removed sorting of entity lists.

It looks like these lists do not need to be sorted. As this happens every frame I removed it.

Attachments (3)

threading_and_sorting.zip (2.6 KB ) - added by _db_ 10 years ago.
0001-Reduce-awakening-of-UserReport-thread.patch (1.2 KB ) - added by Radagast 10 years ago.
0003-Removed-default-sorting-of-list.patch (5.7 KB ) - added by Radagast 10 years ago.

Download all attachments as: .zip

Change History (8)

by _db_, 10 years ago

Attachment: threading_and_sorting.zip added

comment:1 by sanderd17, 10 years ago

Keywords: patch added
Milestone: Alpha 16Alpha 17

You should follow the guidelines on SubmittingPatches

And publish your patches as text, not as zip. Now it's too hard to review.

Add the review tag when it's updated.

comment:2 by Josh, 10 years ago

Your first patch needs spaces around the logical operators but otherwise looks fine. See Coding Conventions.

comment:3 by sanderd17, 10 years ago

For the second patch, I can see it might be unneeded in for the minimap. But it will almost certainly be needed for the territory manager. If you remove the sorting there, it might end up with different territories for different players, which will cause an OOS.

So that method shouldn't get a "TODO, remove this" comment.

comment:4 by Philip Taylor, 10 years ago

UserReport thread is notified every frame

Currently it should only be notified once every TIMER_CHECK_INTERVAL (10 seconds). If that logic is broken then it should be fixed; if it's working then I don't see the need for this patch.

It looks like these lists do not need to be sorted.

There's already a GetEntitiesWithInterfaceUnordered function, so there's no need to add any new code in ComponentManager. But I think that will cause bad behaviour on the minimap - the order affects how overlapping objects are rendered, and the unordered entity lists might change randomly from turn to turn (it's a std::unordered_map so adding one entry might re-hash the entire data structure), which would cause ugly flashing on the minimap.

comment:5 by historic_bruno, 10 years ago

Milestone: Alpha 17
Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.