关键部分和dll [英] critical sections and dll's

查看:122
本文介绍了关键部分和dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我遇到了多线程问题,我找不到很好的答案,

我的大多数代码都位于支持我的程序的dll中,它在其内部对象中创建线程.客户端应用程序也会创建一些.

这些线程是在同一进程中创建的,还是dll创建自己的进程?我也没有对CreateProcess进行任何调用.

出现此问题的原因是,我希望在dll和应用程序之间使用关键部分,因为研究表明,在某些体系结构上,互斥锁每个锁最多可以使用600个周期.

对于某些人来说,这似乎是一个愚蠢的问题,但是我对互联网和文本的访问受到限制,而且我在假设的基础上编写了很多行代码,只是想让自己的举动推翻我的***.因此,我感到无怨无悔总比后悔好.

干杯.

Hi all, I have a multithreading issue I cannot find a good answer for,

I have a majority of my code in a dll that I have made to support my program, it creates threads in its internal objects. The client application creates a few as well.

Are these threads all created in the same process or does the dll create its own process. I don''t make any calls to CreateProcess either.

The reason for this question is I want to use critical sections between my dll and app as research has revealed that mutexes can use up to 600 cycles per lock on some architectures.

This may seem like a stupid question to some but I have limited access to the internet and texts, also I have written many lines of code on an assumption only to have the umption shoved up my ***. So i feel its better to be umption free than sorry.

cheers.

推荐答案

使用的dll通常是进程内",因此您可以使用关键部分.如果它是您使用的COM服务器dll,则将不适用.在这种情况下,它将是进程外的",您应该使用互斥锁.

祝你好运!
A dll used is normally "in-process" and therefore you could use critical sections. This would not apply if it would be a COM server dll that you use. In that case it would be "out-of-process" and you should use a mutex instead.

Good luck!


很确定DLL已加载到应用程序进程中,并且所有线程都在该
中创建
下载Process Explorer http://technet.microsoft.com/en-us/sysinternals/bb896653 [ ^ ],您可以浏览过程创建的线程(如果您仍然没有的话,这是非常宝贵的工具!)



刚要添加有关进行中"和进行中"的信息(我记得我在VB6的日子!),但遭到了殴打.
Pretty sure the DLL is loaded into the application process and all threads are created within that

Download Process Explorer http://technet.microsoft.com/en-us/sysinternals/bb896653[^] and you can browse the threads your process has created (invaluable tool if you don''t have it anyway!)



Was just about to add about ''in process'' and ''out of process'' (i remember from my VB6 days!), but been beaten to it.


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

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