Skip to content
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

Add a ThreadPool concept for CoreContext #546

Merged
merged 5 commits into from Jun 9, 2015
Merged

Conversation

codemercenary
Copy link
Contributor

The thread pool concept allows users to attach a lambda to the context to be executed by that context's thread pool. By default, contexts receive the thread pool of their parent, and the global context gets the default thread pool for the system. Contexts assign their thread pool to the thread pool of their parent upon initiation (not construction). Prior to initiation, contexts hold the null thread pool, which is an instance of NullPool that simply accumulates dispatchers until the parent context is initiated, shut down, or destroyed.

Setting a context's thread pool will not cause the context to release its reference to the NullPool. Instead, the provided thread pool will be held until the context is started, and when this happens, all dispatchers will be transferred to the requested pool and then the requested pool will be initiated.

Jobs added to a context's thread pool will not be run until the context is started.

  • Builds and tests pass on Windows x86
  • Builds and tests pass on Windows x64
  • Builds and tests pass on Mac

@codemercenary codemercenary force-pushed the feature-threadpool branch 3 times, most recently from 04e281d to 5932e6b Compare June 9, 2015 01:45
The thread pool concept allows users to attach a lambda to the context to be executed by that context's thread pool.  By default, contexts receive the thread pool of their parent, and the global context gets the default thread pool for the system.  Contexts assign their thread pool to the thread pool of their parent upon initiation (not construction).  Prior to initiation, contexts hold the null thread pool, which is an instance of NullPool that simply accumulates dispatchers until the parent context is initiated, shut down, or destroyed.

Setting a context's thread pool will not cause the context to release its reference to the NullPool.  Instead, the provided thread pool will be held until the context is started, and when this happens, all dispatchers will be transferred to the requested pool and then the requested pool will be initiated.

Jobs added to a context's thread pool will not be run until the context is started.
@gtremper
Copy link
Contributor

gtremper commented Jun 9, 2015

I have 4 failing tests on Mac:

  • ThreadPoolTest.SimpleSubmission
  • ThreadPoolTest.PoolOverload
  • ThreadPoolTest.StlPoolTest
  • ThreadPoolTest.PendBeforeContextStart

Which is every ThreadPoolTest except for ManualThreadPoolBehavior. They seem to be failing inconsistently as well. If I run only the ThreadPoolTest.* tests, they all seem to pass.

@codemercenary
Copy link
Contributor Author

Can you print the failure messages?

@gtremper
Copy link
Contributor

gtremper commented Jun 9, 2015

The appended lambdas seem to not run consistently. They tests fail because the wait_for call on the promise times out. I'm going to lower the timeout time because 30 seconds makes testing this tedious

@codemercenary
Copy link
Contributor Author

Sure thing, thanks for the help.

@codemercenary
Copy link
Contributor Author

Lowering it to 5 should be fine.

@codemercenary
Copy link
Contributor Author

OK, I'm able to get the same failure. I'm looking into this now.

gtremper added a commit that referenced this pull request Jun 9, 2015
Add a ThreadPool concept for CoreContext
@gtremper gtremper merged commit 8cf1ceb into develop Jun 9, 2015
@gtremper gtremper deleted the feature-threadpool branch June 9, 2015 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants