线程操作带来快速 [英] Thread Operation to bring fast

查看:96
本文介绍了线程操作带来快速的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



请提出一个解决我的难题的想法.
我将通过回调函数从硬件设备获得大约3毫秒的数据.每当我将数据接收到类库中时,我都会填写链接列表,以免过度写入.我将使用线程从UI中采用该链接列表静态对象".在这种情况下,如果使用单个线程,则可以完美地获取数据.如果此UI中正在运行任何其他线程,则所有线程的运行速度都会很慢.请帮帮我,可能是什么原因?
我也保留了线程优先级,但是没有用.

问候,
KV Subrahmanyam,
CMC ltd,海得拉巴.

Hi,

Please give an idea to solve my poblem.
I will get the data from a hardware device is about 3 milli secs fast by a call back function. Whenever I recieve the data into my class library, I fill into a linked list not to over write. I will adopt that linked list "static object" from my UI using a thread. In this scenario, I am getting the data perfectly if I use a single thread. If any other threads are running in this UI, all the threads are running slow. Please help me , what might be the reason ?
I kept thread priority also, but no use.

Regards,
KV Subrahmanyam,
CMC ltd, Hyderabad.

推荐答案

如果要对所有要卸载的线程使用单个静态链接列表,则可能是它们必须等待每个线程其他完成,并释放链表供下一个要写入的文件.

您将不得不想出另一种机制来收集所有数据,例如列表或堆栈池,然后有另一个线程进行所有清理和集中化数据.

也许您需要使线程的链表的数量达到两倍(猜测),然后对它们进行循环处理,以确保一个线程从不等待另一个线程.
If you are using a single static linked list for all the threads to offload onto, then the likelihood is they are having to wait for each other to finish and the linked list is released for the next one to write to.

You will have to come up with another mechanism for all the data to be collected on, e.g. a pool of list or stacks, and then have a another thread that does all the cleanup and centralising the data.

Maybe you will need to have twice (a guess) the number of linked lists to threads and round robin them to make sure a thread is never waiting for another.


这篇关于线程操作带来快速的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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