如何在不进行调试(如启动调试模式)的情况下运行项目启动? [英] how to run project starting without debuging like starting debugging mode?

查看:110
本文介绍了如何在不进行调试(如启动调试模式)的情况下运行项目启动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在使用C ++ Managed 2010在form.h文件中设计GUI. GUI充当主服务器,查询从属卡中的数据流.

按下一个按钮(在ApplicationIO.cpp文件中)将调用一个函数,其中使用API​​ win32(CREATETHREAD(...))创建2个线程:前者用于处理数据流,后者用于数据解析和在GUI上通过实时grpah进行数据监视.

该项目具有两种不同的行为:如果它以调试模式启动,则能够在数据分层期间将GUI控件更新为文本框(使用invoke)和图形,相反,当它启动而没有调试时,文本框中没有数据,并且数据显示得非常好.慢慢在图表上.

如何在不像启动调试模式那样进行调试的情况下运行项目启动?

Hi everyone, i''m using C++ managed 2010 for designing a GUI in a form.h file. The GUI acts as a master querying data streaming from slave card.

Pressing a button a function (in the ApplicationIO.cpp file) is called in which 2 threads are created by using API win32 (CREATETHREAD(...)): the former is for handling data streaming, and the latter is for data parsing and data monitoring on real time grpah on the GUI.

The project has two different behaviour: if it starts in debugging mode it is able to update GUI controls as textbox (using invoke) and graph during data straming, contrariwise when it starts without debugging no data appears in the textbox, and data are shown very slowly on the chart.

how does it is possible to run project starting without debuging like starting debugging mode?
is the problem about project settings, or is "begininvoke" a solution to use instead invoke?

推荐答案

两种不同的行为是您希望其工作的方式吗?您是在问为什么在有调试器或无调试器的情况下运行不一样?无论调试器是否附加到该进程,它都应该工作相同.

关于Invoke问题,您想要做什么(从非UI线程更新UI)有一些变体.所有这些方式都是有效的,并且应该产生相同的结果.
Are the two different behaviors the way you want it to work, or are you asking why it doesn''t work the same when running with or without the debugger? It should work the same regardless of whether or not the debugger is attached to the process.

Regarding the Invoke question, there are a few variations on what you want to do (updating the UI from a non-UI thread). All of these ways are valid and should produce the same results.


线程代码中的Debug和Release配置中的不同行为是竞争状况的一个好兆头,请参见http://en.wikipedia.org/wiki/Race_condition [ ^ ].我更喜欢这种现象的更具描述性的形式:对执行顺序的不正确依赖".请检查线程通信的逻辑以及共享资源的使用.

不太可能的原因是自动填充C ++对象中未分配的成员,这在Debug配置中更具确定性.

—SA
Different behavior in Debug and Release configuration in threaded code is a good sign of race condition, see http://en.wikipedia.org/wiki/Race_condition[^]. I prefer more descriptive form of such phenomena: "incorrect dependency on the order of execution". Please checkup the logic of your threads communications and use of shared resources.

Less likely reason is automatic filling of non-assigned members in C++ objects which can be more deterministic in Debug configuration.

—SA


这篇关于如何在不进行调试(如启动调试模式)的情况下运行项目启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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