Click here to Skip to main content
15,867,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All!

I have a very heavy MFC COM(automation) server. It start up like 3+ seconds on my computer, and even longer on slower ones.
I have a problem with the first interface call from the scripting clients(VBA, C#, etc...),
it crashes the program, because the program didn't finished initialization yet.
Now I got around it by putting the delay for 5 sec into client script after instantiating the COM server but before the first interface call. So far it works, but I think would be better to put into the first interface call some multithreaded functionality which will wait for the application's initialization to finish, and then finish the call.

Looks like inside the first called interface method I have to create suspended thread, and when the MFC COM server will go to ::OnIdle() resume that thread execution, which will cause the first interface method to finish.

- Is this scenaio make sence, or something else could be done in this case?
I appreciate any thoughts and samples of code(this is my first experience with multithreating).

Thanks.
Posted
Updated 18-Jul-13 6:12am
v2

1 solution

Until your application is up and running, you should be returning an error or a not-ready indicator.

Don't make the client wait a long period of time for a reply.
 
Share this answer
 
Comments
H.Brydon 18-Jul-13 13:17pm    
Right (+5) and any solution involving a timer is bad juju.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900