使用共享内存访问的线程 [英] thread using shared mem access

查看:160
本文介绍了使用共享内存访问的线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我是一名电子专业的学生,​​不熟悉S/W,从事S/W开发.使用Visual Studio 6.0 Win32控制台应用程序.
我有一个主要功能,其中我正在检查一些逻辑,我需要宣布一些语音警告.它工作正常.我需要我的代码每20毫秒运行一次.
工作的一部分是宣布警告.当在main()中宣布时,要花费超过20ms的时间来宣布并且我的系统出现故障.
我需要知道如何使用线程概念通过共享内存访问"来播放警告.主要是检查逻辑,然后线程必须控制并必须播放,但是主代码将每20毫秒独立于线程运行一次. 请帮助

Hi there,
I am an electronics student,don''t know much the s/w, working in s/w development.Using visual studio 6.0 win32 console application.
i have one main function in which i am checking some logic and i need to announce some voice warnings.Its working fine.I need my code to run for every 20ms.
part of the job is to announce the warnings.when announcing in the main(), it is taking much time to announce exceeding over 20ms and my system is failing.
i need to know how can i use "thread concept thro'' shared memory access" to play the warnings.In main i''ll check the logic and then thread has to take the control and it has to play, but the main code wil run every 20 msec independent of the thread... please help

推荐答案

如果不是"如果在单个线程中工作,将其移至另一个线程可能无济于事:宣布语音警告所需的时间相同.也许您需要做的就是查看是否有一种方法可以异步处理语音内容-将其启动并让声卡和/或驱动程序处理工作.
您目前如何进行语音警告?
If it isn''t working in a single thread, it may not help if you move it to another: it will take the same amount of time to announce a voice warning. Perhaps what you need to do is look to see if there is a way you can asynchronously do the voice stuff - start it off and let the sound card and/or drivers handle the work.
How are you doing the voice warnings at the moment?


您以这种速度宣布"了什么?那是50Hz,除非它只是一个可听见的铃声(或类似的声音),否则该速率太快了,无法宣布任何有意义的东西.也许您需要重新考虑要完成的任务或完成的方式.
What are you "announcing" at that rate? That''s 50Hz, unless its just an audible ring (or something similar), that rate is too fast to announce anything meaningful. Perhaps you need to reconsider what you''re trying to accomplish or how you''re trying to accomplish it.


这篇关于使用共享内存访问的线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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