完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
所以,在我的vfr朋友的帮助下,我能够解决引用的问题。
对于它的价值,这就是我做错了,为什么我这样做以及如何修复它:我的应用程序允许配置一些UDP端口来接收数据。 预计输入数据将以构成标识符的一系列字符开始。 当数据到达端口时,事件驱动代码提取第一组字符并将其用作全局变量的名称,然后将其设置为整个输入字符串的值。这样可以完美地工作直到发生输入错误并且代码 试图使用非法变量名称。 为了防止这种情况停止应用程序,我将变量名和目标值传递给只包含“Set”对象的函数。 以这种方式使用函数允许在事件服务代码中捕获“坏变量名”错误。 不幸的是,我只为所有要输入的UDP输入事件线程提供了一个函数。 显然,给了几个小时,这导致了一个“竞争”条件,它阻止了许多(但不是全部)应用程序线程。 一切看起来很好,但很少做。我通过为每个UDP输入事件线程提供单独的“Set”功能来修复这种情况。 该应用程序已经运行了两天,没有任何问题 - 每秒大约10 msgs分布在3个UDP端口上。我有点慢学习 - 我在过去犯了同样的错误。 它来自于相信我所读到的关于函数在被调用后运行到结论的内容。 显然,事件驱动的函数不能以这种方式工作 - 看起来你不希望允许事件驱动的代码与任何其他线程共享函数; 主要应用程序线程或其他事件代码threads.Barriewhoi 以上来自于谷歌翻译 以下为原文 So, with a little help from my vfr friends, I was able to solve the referenced problem. For what its worth, here's what I did wrong, why I did it and how I fixed it: My application allows some number of UDP ports to be configured to receive data. The incoming data is expected to begin with a sequence of characters that constitute an identifier. When data arrives at a port, the event driven code extracts the 1st group of characters and uses it as the name of a global variable which it then sets to the value of entire input string. This works perfectly until an input error occurs and the code attempts to use an illegal variable name. In order to prevent this from stopping the application, I passed the variable name and the intended value to a function that contained nothing but a "Set" object. Using a function in this manner allowed trapping "bad variable name" errors in the event service code. Unfortunately, I only provided one function for all the UDP input event threads to share. Apparently, given a few hours, this led to a "race" condition which stopped many (but not all) of the application threads. Everything looked fine but very little was being done. I fixed the situation by providing a separate "Set" function for each of the UDP input event threads. The application has been running for two days now without a problem - about 10 msgs per second spread over 3 UDP ports. I'm somewhat of a slow learner - I've made this same mistake in the past. It comes from believing what I've read about functions running to conclusion once they have been called. Apparently event driven functions don't work this way - it appears that you don't want to allow event driven code to share functions with any other threads; primary application threads or other event code threads. Barrie whoi |
|
相关推荐
1个回答
|
|
Hello Barrie,>开发分析器似乎表明运行的唯一代码是>少数事件驱动的串行输入函数。
查看这些代码线程>显示它们定期运行而没有问题 - 完全符合>预期。 我找不到任何其他代码>线程中的任何生命迹象,包括一个简单的循环时间display.did我理解你的程序确实停止执行但是从VEE开发它仍然似乎运行? 因此,当您使用绿色框(执行流程)跟踪当前活动的vee对象时,您会看到一些浅绿色的对象,并且Ve似乎在这里挂起?如果是这样,并且您的“事件驱动的串行输入函数”指向我指向该方向, 由于vee在运行时无法执行某个功能,因此我很难假设死锁:如果函数A正在执行并且事件中断该执行并再次尝试调用函数A,则会发生此死锁 - 没有任何错误消息等。 如果你将事件用作一种中断例程,请记住以下事项: - 使中断例程尽可能短而快(在旧的8088上也是如此 - 并且仍然是这样) - 不要从中断例程中调用任何函数 。 一个解决方案通常是在这里举起一个标志并在'并行'的vee线程上测试它。 cou可以安全地调用所需的功能。我希望这是你的问题,我可以给你一些帮助,但GeorgGeorg Nied Software-Development Hansestr。 7 51149科隆德国电话:+49(2203)9770915传真:+49(2203)9770924电子邮件:info@gn-software.de---您目前订阅了vrf:r***@soco.agilent.com订阅发送 一封空白的电子邮件至“join-vrf@it.lists.it.agilent.com”。要取消订阅,请发送一封空白电子邮件至“leave-vrf@it.lists.it.agilent.com”。要向此邮件列表发送邮件 ,发送电子邮件至“vrf@agilent.com”。 如果您需要有关邮件列表的帮助,请发送邮件至“owner-vrf@it.lists.it.agilent.com”。 以上来自于谷歌翻译 以下为原文 Hello Barrie, > The development profiler appears to show that the only code running is a > few event driven serial input functions. Looking at these code threads > shows that they are running periodically without problems - exactly as > expected. I can't find any signs of life in any of the other code > threads, including a simply looping time display. did I understand you correctly that your program did stop executing but from VEE-development it still seems to run? So when you trace the currently active vee objects with the green boxes (execution flow) you see some objects that are light green and vee seems to hang here? If so, and your 'event driven serial input functions' pointed me to that direction, I stromgly assume a deadlock due to the fact that vee cannot execute a function when it is already running: if function A is executing and an event interrupts that execution and tries to call function A again this deadlock occurs - without any error message or such. If you use events as kind of interrupt routines keep trhe following things in mind: - make the interrupt routine as short and quick as possible (this was true on the old 8088 - and is still) - do not call any functions from the interrupt routine. A solution is often to raise a flag here and test it on a 'parallel' vee thread. There cou can safely call the desired function. I hope that was your problem and I could give you some assistance best regards, Georg Georg Nied Software-Development Hansestr. 7 51149 Cologne Germany Tel: +49 (2203) 9770915 Fax: +49 (2203) 9770924 E-Mail: info@gn-software.de --- You are currently subscribed to vrf as: [email=r***@soco.agilent.com]r***@soco.agilent.com[/email] To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com". To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com". To send messages to this mailing list, email "vrf@agilent.com". If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com". |
|
|
|
只有小组成员才能发言,加入小组>>
1298 浏览 0 评论
2378 浏览 1 评论
2199 浏览 1 评论
2068 浏览 5 评论
2955 浏览 3 评论
1140浏览 1评论
关于Keysight x1149 Boundary Scan Analyzer
760浏览 0评论
N5230C用“CALC:MARK:BWID?”获取Bwid,Cent,Q,Loss失败,请问大佬们怎么解决呀
950浏览 0评论
1298浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-29 02:33 , Processed in 1.189857 second(s), Total 46, Slave 40 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号