Waiting w/o burning CPU
Hi,
Could anyone tell me which Xenomai function should I use to wait (even up to 100msecs) without burning CPU. I tried using nanosleep() but it was always returning with 1 (one) and analyzing my output pins with an oscilloscope I couldn't see any time delays. Now I use rt_timer_spin() but I'm not sure whether I'm doing any wrong to my rt threads (or anyone else in the kernel). My environment: a kernel driver with lots of rt threads controlling stepper motors. The function where I want to wait is a work_struct task (called by a schedule_work). Thanks.
-- joseph
Quoted 10 lines · Jozsef Lazar
Hi,
Could anyone tell me which Xenomai function should I use to wait (even up to 100msecs) without burning CPU. I tried using
nanosleep()but it was always returning with 1 (one) and analyzing my output pins with an oscilloscope I couldn't see any time delays. Now I usert_timer_spin()but I'm not sure whether I'm doing any wrong to my rt threads (or anyone else in the kernel). My environment: a kernel driver with lots of rt threads controlling stepper motors. The function where I want to wait is awork_structtask (called by aschedule_work). Thanks.
A work_struct task is a Linux task, not a xenomai thread. Xenomai functions work for Xenomai thread. The behaviour of nanosleep is documented here:
1 is EPERM.
Signature · 1 line
Gilles
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 19 lines · Jozsef Lazar
Gilles Chanteperdrix írta:
Quoted 18 lines
Quoted 11 lines · Jozsef Lazar
Hi,
Could anyone tell me which Xenomai function should I use to wait (even up to 100msecs) without burning CPU. I tried using
nanosleep()but it was always returning with 1 (one) and analyzing my output pins with an oscilloscope I couldn't see any time delays. Now I usert_timer_spin()but I'm not sure whether I'm doing any wrong to my rt threads (or anyone else in the kernel). My environment: a kernel driver with lots of rt threads controlling stepper motors. The function where I want to wait is awork_structtask (called by aschedule_work). Thanks.A
work_structtask is a Linux task, not a xenomai thread. Xenomai functions work for Xenomai thread. The behaviour of nanosleep is documented here:
Quoted 7 lines
Quoted 5 lines
1 is EPERM.
Thank you for your answer. I thought that I have such a problem. Any suggestions which function should I use?
Linux provides several functions for suspending threads, such as msleep, schedule_timeout_interruptible, wait_event_interruptible, whatever you want. Anyway this question is related to Linux, not to Xenomai, so you will find better answers in other places than on Xenomai mailing-lists, I am not even sure you can suspend a work queue.
Please do not drop the CC to mailing list when replying.
Regards.
Signature · 1 line
Gilles