锁定调用永不返回的方法 [英] Locked on calling a method that never returns

查看:80
本文介绍了锁定调用永不返回的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WPF / C#应用程序,它调用永远不会返回的DLL方法。基本上,我调用的这个方法创建了一个与ArcNet协议的连接,并在板上返回一个内存地址。



问题是当没有ArcNet时,我的调用方法就坐了在那里,我被卡住了。



我想做的是调用方法,如果我在500ms内没有得到回报,我继续,或者在这种情况下,抛出错误并继续。



谢谢,

I have a WPF/C# app that calls a DLL method that never returns. Basically, this method I call creates a connection with ArcNet protocol and returns a memory address on a board.

Problem is when there is no ArcNet, my calling method just sits there and I'm stuck.

What I want to do, is call the method and if I don't get something back within 500ms, I continue on, or in this case, throw an error and continue on.

Thanks,

推荐答案

看看 Task.Wait 此处: http://stackoverflow.com/questions/4036198/does-task-waitint-stop-the-task-if-the-timeout-elapses-without-the-任务完成 [ ^ ]


这篇关于锁定调用永不返回的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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