Forum at OOoForum.orgThe Forum
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Extension development and multithreading

Post new topic   Reply to topic Forum Index -> Macros and API
View previous topic :: View next topic  
Author Message

Joined: 20 Sep 2010
Posts: 1

PostPosted: Tue Sep 21, 2010 12:05 am    Post subject: Extension development and multithreading Reply with quote


I have a problem with one of the extensions (C++/Win) I'm trying to write. In this component I need to use an external DLL, which in turns calls COM component, and, because of that, requires COM to be initialized.

Since I can't call CoInitialize on the application thread, I have a worker thread that I use for work items, and I schedule work items to that thread. So far, the main functionality works without any problems, but the problem appears when I want to do a cleanup.

As far as I understand, the components disposing function is the place you should do all the cleanup (destructor gets called even later), but unfortunately, by the time it gets there, my worker thread is long gone. And the weird thing is that it doesn't return through the (return 0;), and I can't catch a call to TerminateThread or ExitThread(RtlExitUserThread), although, the Visual Studio debugger reports that the thread has exited with retval 0x0 before I stop inside disposing function.

By the time I reach disposing, there seems to be only 1 thread left.

Who or what is closing the worker threads and how do I do the worker thread shutdown?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Forum Index -> Macros and API All times are GMT - 8 Hours
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group