简体   繁体   English

DLL在运行时停止主线程

[英]DLL stop main thread when running

I call a DLL written in C++ (VS2012) from a software (LabView) and what it does is uploading a file on a server via FTP. 我从软件(LabView)调用了用C ++(VS2012)编写的DLL,它的作用是通过FTP将文件上传到服务器上。

While the DLL is uploading the file (15MB) it does not let LabView continue with other tasks. DLL上传文件(15MB)时,它不允许LabView继续执行其他任务。 How could this problem be solved? 这个问题怎么解决?

Regardless of what you have to do on the C++ side to make the call threadsafe, you will need to configure the call in LabVIEW not to run in the UI thread (which I believe is the default configuration, for safety reasons). 不管您要在C ++端执行什么操作以使调用线程安全,都需要在LabVIEW中将调用配置为不在UI线程中运行(出于安全原因,我认为这是默认配置)。 Double click the node and select the run in any thread option. 双击节点,然后选择“在任何线程中运行”选项。

Also, if you want to ensure running it in its own thread, you can put it in a separate VI and change the execution settings of that VI to run in a different execution system. 另外,如果要确保在自己的线程中运行,可以将其放在单独的VI中,并更改该VI的执行设置以在其他执行系统中运行。 LabVIEW doesn't give you direct control of threads, because it manages them on its own, but this should make the VI execute in a different thread. LabVIEW不直接控制线程,因为它是自己管理线程的,但这将使VI在不同的线程中执行。

Operations with FTP are long-term. FTP的操作是长期的。 It is better to perform such operations in another thread. 最好在另一个线程中执行此类操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在主线程外询问运行对象表(ROT)时出错 - Error when asking Running Object Table (ROT) out of main thread 停止在线程中运行的类方法 - Stop class method running in thread 从Java调用C ++ DLL方法时,线程“ main”中的异常java.lang.UnsatisfiedLinkError - Exception in thread “main” java.lang.UnsatisfiedLinkError When Calling a C++ DLL Method from Java 从Java运行本机dll时,线程“主” java.lang.UnsatisfiedLinkError中的异常:Native.initiate(I)V - Exception in thread “main” java.lang.UnsatisfiedLinkError: Native.initiate(I)V while running native dll from Java 停止来自主线程的无限循环线程 - Stop infinite looping thread from main 作为.dll的一部分运行.exe的main() - Running an .exe's main(), as part of a .dll 如何停止和销毁主线程(从中创建线程) - How to stop and destroy thread from main thread (from which is created) 如何在MFC中停止主线程和等待子线程 - How can I stop main thread and waiting sub thread in MFC 当主线程无限循环运行时,服务器未收到用QTcpSocket :: write写入的字节吗? - Bytes written with QTcpSocket::write has not been received by server when Main Thread running in infinite loop? 如何确定我们是否在主线程中运行? - How to find out if we are running in main thread?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM