New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cleanup] Simplifies the overly complex threading logic #516

Merged
merged 4 commits into from Jan 12, 2016

Conversation

Projects
None yet
2 participants
@ulteq
Contributor

ulteq commented Jan 2, 2016

This only affects the interTruckCollision:

  • Instead of having a fixed number of thread tasks and skipping trucks based on the thread index, we now have one thread task per simulated truck.
  • The workload is distributed dynamically by the operating system.

Positive side effect: A better (more uniform) CPU usage when multiple vehicles collide.

Edit 1:

  • Moved parts of the multi-threading logic from the Beam class into the BeamFactory class.

Edit 2:

  • Fixes a bug where only one truck would be simulated when the thread pool is deactivated.
@only-a-ptr

This comment has been minimized.

Show comment
Hide comment
@only-a-ptr

only-a-ptr Jan 4, 2016

👍 For making Beam::interTruckCollisions() an actual Beam method rather than an obfuscated semi-global function.
👍 For reducing complexity
👍 For more straightforward code

only-a-ptr commented on 288cfe3 Jan 4, 2016

👍 For making Beam::interTruckCollisions() an actual Beam method rather than an obfuscated semi-global function.
👍 For reducing complexity
👍 For more straightforward code

@only-a-ptr

This comment has been minimized.

Show comment
Hide comment
@only-a-ptr

only-a-ptr Jan 5, 2016

👍 for erradicating int Beam::num_simulated_trucks

Now that you're at it, could you move threadentry() and runThreadTask() into BeamFactory? 😇

only-a-ptr commented on 2f2669c Jan 5, 2016

👍 for erradicating int Beam::num_simulated_trucks

Now that you're at it, could you move threadentry() and runThreadTask() into BeamFactory? 😇

ulteq added some commits Jan 6, 2016

[Codechange] Moved threadentry into the BeamFactory
* Also moved runThreadTask into the BeamFactory

* frameSteps is now based on discrete steps
@only-a-ptr

This comment has been minimized.

Show comment
Hide comment
@only-a-ptr

only-a-ptr Jan 12, 2016

Member

Yay! 😃 Awesome!

Member

only-a-ptr commented Jan 12, 2016

Yay! 😃 Awesome!

only-a-ptr added a commit that referenced this pull request Jan 12, 2016

Merge pull request #516 from ulteq/multiThreadingCleanup
Signifficant cleanup of physics and multithreading.
* Simplified overly complex threading logic - Instead of having a fixed number of thread tasks and skipping trucks based on the thread index, we now have one thread task per simulated truck.
* Moved MT physics management logic from class Beam -> class BeamFactory (singleton). This cleans up duplicated and misplaced threading logic away from Beam instances.

@only-a-ptr only-a-ptr merged commit 2c1a9d3 into RigsOfRods:master Jan 12, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@ulteq ulteq deleted the ulteq:multiThreadingCleanup branch Jan 12, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment