I have a service application, that creates a thread (A) to perform some business logic, which in turn creates thread (B), that holds a TMSConnection and TMSQuery. Thread (B) will execute whatever query thread (A) requires, and when done, goes into a suspended state until (A) either terminates it or gives it another query.
The problem now is that sometimes, (B) never returns from running its query. Using Profiler, I can see that the query completed on SQL Server's side, but in my app, the Execute method never returns.
Now, in thread (A), I need to call CoInitializeEx(nil, COINIT_MULTITHREADED). In thread (B), do I still need to call CoInitialize(nil), though it does not seem to make a difference.
Any suggestions? Thanks.
Ray Mond
Question on Coinitialize
> The problem now is that sometimes, (B) never returns from running its query
Please send us complete small sample to demonstrate it and include
script to create server objects.
> Now, in thread (A), I need to call CoInitializeEx(nil, COINIT_MULTITHREADED).
> In thread (B), do I still need to call CoInitialize(nil), though it does not seem to make
> a difference.
Usually you must call CoInitialize or CoInitializeEx in that thread where the connection is.
Please send us complete small sample to demonstrate it and include
script to create server objects.
> Now, in thread (A), I need to call CoInitializeEx(nil, COINIT_MULTITHREADED).
> In thread (B), do I still need to call CoInitialize(nil), though it does not seem to make
> a difference.
Usually you must call CoInitialize or CoInitializeEx in that thread where the connection is.