第一个客户端调用重型COM(自动化)服务器。 [英] First Client call into the heavy COM(automation) server.

查看:81
本文介绍了第一个客户端调用重型COM(自动化)服务器。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!



我有一台非常重的MFC COM(自动化)服务器。它在我的计算机上启动时间超过3秒,在慢速启动时启动时间更长。

我对脚本客户端的第一个接口调用有问题(VBA,C#等等),

它崩溃了程序,因为程序还没有完成初始化。

现在我通过在实例化COM后将延迟5秒放入客户端脚本来解决它服务器但在第一次接口调用之前。到目前为止它可以工作,但我认为最好在第一个接口调用一些多线程功能,等待应用程序的初始化完成,然后完成调用。



看起来在第一个调用的接口方法里面我必须创建挂起的线程,当MFC COM服务器将转到:: OnIdle()恢复该线程执行时,这将导致第一个接口方法完成。



- 在这种情况下,这个场景是否有效,或者其他什么可以做?

我感谢任何想法和代码示例(这是我的多线程的第一次体验。



谢谢。

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.

推荐答案

在您的应用程序启动并运行之前,应该返回一个错误或一个未准备好的指示器。



不要让客户端等待很长一段时间来回复。
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.


这篇关于第一个客户端调用重型COM(自动化)服务器。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆