Refactor Secondary Threads #12

Merged
EmaMaker merged 4 commits from multithread-refactor into main 2023-10-04 13:32:42 +02:00

Refactors structure of and communication between secondary threads:

  • Update thread holds information about all chunks in concurrent_hash_map
  • Use parallel_for to iterate over all chunks
  • Keep using priority queues to send data from update to generation/meshing threads. Use chunk state to mark whether a chunk is in a queue (Resolves memory leak: continously adding new elements to queues)
  • Use ChunkTable::accessor to access elements for erasure from chunks concurrent_hash_map (Resolves memory leak: not deleting old chunks and freeing their memory)
Refactors structure of and communication between secondary threads: - Update thread holds information about all chunks in concurrent_hash_map - Use parallel_for to iterate over all chunks - Keep using priority queues to send data from update to generation/meshing threads. Use chunk state to mark whether a chunk is in a queue (Resolves memory leak: continously adding new elements to queues) - Use ChunkTable::accessor to access elements for erasure from chunks concurrent_hash_map (Resolves memory leak: not deleting old chunks and freeing their memory)
EmaMaker added 4 commits 2023-10-04 13:13:38 +02:00
88abf21502 multithread: refactor update thread, communication between mesh/gen/upd threads
- Use parallel_for to iterate over all the stored chunks
- Only push a chunk to a queue if it is not already present, using chunk state bitfield (solves
	memory leak, continously adding new elements to a queue)
- Properly delete an element from chunks concurrent_hash_map using accessor, then free the memory
(solves memory leak: not being able to delete old elements and always adding new ones)

Breaks:

- Rendering (will be properly refactored in a future commit)
- Block picking (will be refactored in a future commit)
EmaMaker added 1 commit 2023-10-04 13:14:14 +02:00
EmaMaker added 6 commits 2023-10-04 13:18:28 +02:00
EmaMaker force-pushed multithread-refactor from 86f906912e to 1d2e8e1848 2023-10-04 13:28:07 +02:00 Compare
EmaMaker force-pushed multithread-refactor from 1d2e8e1848 to 88abf21502 2023-10-04 13:30:54 +02:00 Compare
EmaMaker merged commit 355da726f6 into main 2023-10-04 13:32:37 +02:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: EmaMaker/voxel-engine#12
There is no content yet.