在精确的时间间隔内睡觉 [英] sleeping during a precise time interval

查看:76
本文介绍了在精确的时间间隔内睡觉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我正在编写一个需要暂停几微秒的程序,然后前往



I'v尝试了nanosleep()函数,但这并不精确。我也用了b $ b试图提高我的应用程序的优先级,但是它仍然不够精确。

最高精度可以达到什么我希望在linux工作站上获得它?

有人对实现有什么建议吗?

谢谢

Yannick

解决方案

Yannick Loth< ya ***** @ loth.be>写道:

你好
我正在编写一个需要暂停几微秒的程序,然后继续前进。
我试过nanosleep()功能,但这不是很精确。我也尝试提高应用程序的优先级,但它仍然不够精确。
我希望在linux工作站上获得什么最高精度?



在没有扩展名的情况下,没有办法在标准C中做你想做的事。

尝试comp.unix.programmer或其中一个Linux新闻组。


-

Keith Thompson(The_Other_Keith) ks *** @ mib.org < http://www.ghoti.net/~kst>

圣地亚哥超级计算机中心< *> < http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。


2005年4月7日星期四19:27:53 +0200,在comp.lang.c,Yannick Loth

< ya ***** @ loth.be>写道:

你好
我正在编写一个程序,需要暂停几微秒,然后继续前进。


这在标准C中是不可能的,除了专用硬件之外,很可能在

以外的任何东西。

我试过nanosleep()函数,但这不是很精确。我也试着提高我的应用程序的优先级,但它仍然不够精确。




你会需要在linux / unix编程组中提出这个问题,

并牢记其特定硬件

-

Mark McIntyre

CLC常见问题< http://www.eskimo.com/~scs/C-faq/top.html>

CLC自述文件:< http:// www .ungerhu.com / jxh / clc.welcome.txt>


---- ==通过Newsfeeds.Com发布 - 无限制 - 未经审查 - 安全的Usenet新闻== ----
http://www.newsfeeds.com #1新闻组服务世界! 120,000多个新闻组

---- =东海岸和西海岸服务器农场 - 通过加密实现全隐私= ----


Yannick Loth <亚***** @ loth.be>写道:

#Hello

#我正在编写一个程序,需要暂停几微秒,然后去

#ahead。

#I'我尝试了nanosleep()函数,但这并不太精确。我也是

#尝试提高我的应用程序的优先级,但它仍然不是
#够精确。

#What我希望在linux工作站上获得最高精度吗?

#有人会对实施提出建议吗?

#Thanks


您将需要某种实时操作系统。那些人在特定的时间范围内做出承诺

。大多数操作系统只保证你会等待至少那么长时间,但可以等待更长时间。


-

SM Ryan http://www.rawbw.com/~wyrmwif/

我希望对你来说感觉很好。没有其他的东西可以说明其他人的缺点了吗?


Hello
I''m writing a program which needs to pause exactly some microseconds then go
ahead.
I''v tried the nanosleep() function but this is not much precise. I also
tried it with raising the priority of my application, but it still isn''t
precise enough.
What maximum precision can I hope to obtain on a linux station?
Would someone have a suggestion on the implementation?
Thanks
Yannick

解决方案

Yannick Loth <ya*****@loth.be> writes:

Hello
I''m writing a program which needs to pause exactly some microseconds then go
ahead.
I''v tried the nanosleep() function but this is not much precise. I also
tried it with raising the priority of my application, but it still isn''t
precise enough.
What maximum precision can I hope to obtain on a linux station?



There''s no way to do what you want in standard C without extensions.
Try comp.unix.programmer or one of the Linux newsgroups.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


On Thu, 07 Apr 2005 19:27:53 +0200, in comp.lang.c , Yannick Loth
<ya*****@loth.be> wrote:

Hello
I''m writing a program which needs to pause exactly some microseconds then go
ahead.
this is impossible in standard C, and quite probably impossible on
anything except dedicated hardware.
I''v tried the nanosleep() function but this is not much precise. I also
tried it with raising the priority of my application, but it still isn''t
precise enough.



you''ll need to ask this question in a linux / unix programming group,
and bear in mind its hardware-specific
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----


Yannick Loth <ya*****@loth.be> wrote:
# Hello
# I''m writing a program which needs to pause exactly some microseconds then go
# ahead.
# I''v tried the nanosleep() function but this is not much precise. I also
# tried it with raising the priority of my application, but it still isn''t
# precise enough.
# What maximum precision can I hope to obtain on a linux station?
# Would someone have a suggestion on the implementation?
# Thanks

You''re going to need some kind of real-time operating system. Those make promises
about responses within specific time bounds. Most operating systems guarentee only
that you will wait at least that long, but could wait much longer.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
I hope it feels so good to be right. There''s nothing more
exhilirating pointing out the shortcomings of others, is there?


这篇关于在精确的时间间隔内睡觉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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