Opened 3 years ago
Last modified 4 months ago
#5874 new task
Threading improvements
Reported by: | wraitii | Owned by: | |
---|---|---|---|
Priority: | Must Have | Milestone: | Work In Progress |
Component: | Core engine | Keywords: | |
Cc: | Patch: | Phab:D3848 |
Description (last modified by )
There are issues with our implementation: we use "naked" std::thread instead of cleverer solutions. This, notably, means we fail to detect exceptions happening in the threads (see https://code.wildfiregames.com/rP22649#45341 )
[25656] implements a task manager. Now not every task wich is run concurently does need to create it's own std::thread.
Phab:D4956 does implement exception handling for tasks in the task manager.
These tasks use the task manager:
- map generator
- pathfinder
- texture converter
These tasks should be adapted to use the task manager:
- upnp
A task in the task manager should never 'wait' (for a condition_variable; for a mutex; for some time...) that would put the whole thread to sleep. Instead it would be better to run another task in the meantime and resume the original task later. Phab:D3877 or Phab:D4907 does extend the task manager to make that possible. These tasks rely on such a feature:
- net client (net session) Phab:D3877
- net server
- sound
- user reporter Phab:D4426
Change History (17)
comment:1 by , 3 years ago
comment:2 by , 3 years ago
Description: | modified (diff) |
---|---|
Milestone: | Alpha 24 → Alpha 25 |
Net client was threaded in A24, A25 will hopefully thread the pathfinder.
comment:3 by , 3 years ago
Patch: | → Phab:D3848 |
---|
comment:5 by , 3 years ago
Description: | modified (diff) |
---|
comment:6 by , 3 years ago
Milestone: | Alpha 25 → Alpha 26 |
---|
follow-up: 9 comment:8 by , 2 years ago
@wraitii @stanislas69 what sorts of remaining improvements do we see here? Have some interest in looking at this. Have a fair bit of experience with system programming/threading from my day job.
comment:9 by , 2 years ago
Replying to jprahman:
@wraitii @stanislas69 what sorts of remaining improvements do we see here? Have some interest in looking at this. Have a fair bit of experience with system programming/threading from my day job.
Well, plenty of systems aren't threaded and _could_ be threaded.If you check the last commits of https://github.com/wraitii/0ad/commits/__THREADPOOL, you'll see some ways to thread some systems, such as sound.
More generally, threading is interesting in general as a speedup, though there are limitations on what you can do in 0 A.D.
comment:12 by , 14 months ago
Description: | modified (diff) |
---|---|
Milestone: | Backlog → Work In Progress |
Rewrite the ticket. Task manager wasn't mentioned and i described the problem some tasks have wich are not jet converted. I also added a link two new diffs.
comment:13 by , 13 months ago
Description: | modified (diff) |
---|
user reporter
aslo relyes on a repeating task
.
comment:17 by , 4 months ago
Description: | modified (diff) |
---|
I forgot to refference this ticket in the commit [27984].
https://akrzemi1.wordpress.com/2012/11/14/not-using-stdthread/