多线程和Com对象 [英] Multithreading and Com object

查看:87
本文介绍了多线程和Com对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我有一种情况,我需要从.Net网络服务中调用一个软件。 该软件可通过System.Runtime.Interopservices包装器访问。 在软件中,它可以在
内存中支持8个同步交易。 每个事务都保留自己的ID和驻留在内存中的对象,直到完成时单独删除。 此外,该软件还有一个初始化函数,用于缓存其数据库和一个清理函数,该函数销毁所有事务
并释放内存。


我对多线程很新,我真的可以使用一些关于如何监控8个交易的建议,尤其是在从网络服务调用之后。 在一个线程中,我可以遍历这些并且没有问题但是从webservice调用它,
我需要监视并发查找并确保我不会超过8个concurant。


我非常感谢任何建议。


谢谢,

解决方案

<请尝试使用threadPool
http:// msdn.microsoft.com/en-us/library/system.threading.threadpool(v=vs.100).aspx
 


祝你有愉快的一天。


Hello,

I have a situation where I have a piece of software that I need to call from a .Net web service.  This software is accessible through a System.Runtime.Interopservices wrapper.  Within the software, it can support 8 simultaneous transactions in memory.  Each transaction keeps its own ID and objects that stay resident in memory until individually deleted when finished.  Also the software has an initialize function that caches its database and a cleanup function that destroys all the transactions and frees the memory.

I am fairly new to multithreading and I could really use some advice on how to monitor the 8 transactions, especially since calling from a webservice.  In a single thread, I can loop through these and not have an issue but calling it from a webservice, I need to monitor the concurrent lookups and make sure that I don't go over 8 concurant ones.

I would greatly appreciate any advice.

Thanks,

解决方案

Please try threadPool http://msdn.microsoft.com/en-us/library/system.threading.threadpool(v=vs.100).aspx 

Have a nice day.


这篇关于多线程和Com对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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