Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(SQL Server) Finalize Thread Pool on Program ExitIf your code is calling asynchronous Chilkat methods (i.e. methods having names ending with "Async"), then it's a good idea to call the FinalizeThreadPool when your program is about to exit. It's best if all asynch methods have cleanly finished prior to calling FinalizeThreadPool. If any asynchronous methods are in progress when FinalizeThreadPool is called, they will be aborted and the threads shutdown.
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls. -- CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int -- Asynchronous Chilkat methods are run in background threads managed -- by a thread pool manager thread, which is also a background thread. -- Prior to exiting, it is good practice to ensure all asynchronous methods -- have completed or are aborted/cancelled, and that the thread pool manager -- thread is also shutdown. -- -- The FinalizeThreadPool method should be called just before the application exits -- to ensure all background threads, including the thread pool manager thread, are -- cleanly shutdown. -- This is how to do it: DECLARE @glob int -- Use "Chilkat_9_5_0.Global" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.Global', @glob OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END DECLARE @success int EXEC sp_OAMethod @glob, 'FinalizeThreadPool', @success OUT EXEC @hr = sp_OADestroy @glob END GO |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.