Reputation: 3263
I am using Delphi xe 5 for an application which uses Indy to manage my server application
Each client connection gets its own session which is perfect
Now I need to perform several tasks in aysnc way within one of these sessions
When all of these tasks have been completed control can go back to the caller
I am looking into using a local scoped thread pool in my procedure which will place each task to be performed into the thread pool
I have seen the TIdThreadMgrPool which looks perfect
How do wait until all of my threads have finished?
Paul
Upvotes: 0
Views: 1251
Reputation: 596287
Indy 9's TIdThreadMgrPool
component (replaced with the TIdSchedulerOfThreadPool
component in Indy 10) is not a general-purpose thread pool. It is designed for use only as the client thread pool for Indy's TIdTCPServer
component. There is no option to wait for active threads to finish running, TIdTCPServer
handles that internally while it is being shut down.
There are plenty of 3rd party general-purpose thread-pool implementations available for Delphi, such as OmniThreadLibrary. If you were using XE7, you could take advantage of its new Parallel Programming Library instead.
Upvotes: 1