dexter 0 Posted June 24 Hi, I'm using the GlobalOmniThreadPool like this: CreateTask( procedure(const aTask: IOmniTask) begin FProvider.Execute(Self); end) .OnTerminated( procedure(const aTask: IOmniTaskControl) begin FEvents.FireThreadEndEvent(); end ) .Join(FTaskGroup) .Schedule; During FProvider.Execute() some DB resources are alocated (within task's thread). Questions: 1. For some reason OnTerminated() is not called at all, even when program is finished. 2. When OnTerminated is called - will it be called from thread's context, so I'll release DB resources. If not - is there any event call from thread's context at the end of execution? Share this post Link to post