Menu

#1 Extend ThreadWrapper for scalable shutdown in a collection.

Initial_import.
open
NT-based (3)
5
2013-02-08
2003-03-19
No

A collection of ThreadWrappers in a collection suffers a serialized destruction of the threads. To shut them down in parallel:
1. Add a template param. to the ThreadWrapper: ..., typename ExitEventT ExitEvent = Event, ... (Makes it work as before.)
2. Create a template class ThreadPool that takes the ThreadWrapper-derived class as a template param. & the collection type. Also has members:
Event ExitRequest;
colln_type< ThWr<...., &ExitRequest, ...> > colln;
~ThreadPool() {
ExitRequest.set();
}
3. Ensure ThreadWrapper-derived class declared with "Event *" for ExitEventT template param.

Discussion


Log in to post a comment.