我在线程中用事件响应的方式处理数据,共有10个事件。其中有6个是一秒发一次事件消息,有四个是一秒十次发事件消息。结果发现线程来不及处理有些消息,造成一些数据丢失,请问有什么办法解决?
解决方案 »
- 谁能帮我解释一下下面代码的意思,如果我想在列表显示电信一区应该怎么改!
- ASCII空格space和空null区别
- CreateProcessWithLogonW -> RunAs或Secondary Logon时,用户名被修改的问题
- 求教:利用vc与opengl显示三维数据点
- 字符串类型的va_list最后一个参数用null来判断会有问题吗?
- 急问一程序调试问题!
- 关于函数与指针间类型转换的语法
- 计算机专业研究生毕业
- 关于 MFC ODBC 连接SQL SERVER 的问题,在线等待(最好给出源码示例),焦急!!!
- 这个问题怎么解决????????
- [急切]VC 求一个支持自动化,连接点,可视化的com组件的例子。
- 为什么没有填充这个矩形块
int arraysize = CarrayBattle2Gun1.GetSize();
for(int i=0;i<arraysize;i++)
{
memcpy(Rbuff1,CarrayBattle2Gun1[0].Info,nLength);//将动态数组中数据转移到数组中
Battle2Gun1();//对数据进行处理
CarrayBattle2Gun1.RemoveAt(0);//删除动态数组中的数据
}但问题又来了,有可能队列数据太多,占用过多时间,影响其他事件的处理。
If the data drop are because of short burst high data rate, you could try to same them first and process later. But if data are comming at a steady rate and there is not enough CPU resource to handle them, this could consume all your memory. Or, you can use a ring buffer to store the data. When the buffer is full, just drop the newly arrived data or overwrite the old data.
If you have more than one CPU, you can use more than one data pool and more than one thread to process them.