Sample code for 30+ languages & platforms
PowerBuilder

Finalize Thread Pool on Program Exit

See more Async Examples

If 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.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Glob

// 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:
loo_Glob = create oleobject
li_rc = loo_Glob.ConnectToNewObject("Chilkat.Global")
if li_rc < 0 then
    destroy loo_Glob
    MessageBox("Error","Connecting to COM object failed")
    return
end if
loo_Glob.FinalizeThreadPool()


destroy loo_Glob