All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Waiting w/o burning CPU
@ 2009-12-09 12:55 Jozsef Lazar
  2009-12-09 13:41 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 3+ messages in thread
From: Jozsef Lazar @ 2009-12-09 12:55 UTC (permalink / raw)
  To: xenomai

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xenomai-help] Waiting w/o burning CPU
  2009-12-09 12:55 [Xenomai-help] Waiting w/o burning CPU Jozsef Lazar
@ 2009-12-09 13:41 ` Gilles Chanteperdrix
       [not found]   ` <4B1FACFB.2010809@domain.hid>
  0 siblings, 1 reply; 3+ messages in thread
From: Gilles Chanteperdrix @ 2009-12-09 13:41 UTC (permalink / raw)
  To: Jozsef Lazar; +Cc: xenomai

Jozsef Lazar wrote:
> 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.

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:

http://www.xenomai.org/documentation/xenomai-2.4/html/api/group__posix__time.html#ga9ce6a1ed91a601dee133c8b6cf8b721a

1 is EPERM.

-- 
                                          Gilles



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xenomai-help] Waiting w/o burning CPU
       [not found]   ` <4B1FACFB.2010809@domain.hid>
@ 2009-12-09 14:07     ` Gilles Chanteperdrix
  0 siblings, 0 replies; 3+ messages in thread
From: Gilles Chanteperdrix @ 2009-12-09 14:07 UTC (permalink / raw)
  To: Jozsef Lazar; +Cc: Xenomai help

Jozsef Lazar wrote:
> Gilles Chanteperdrix írta:
>> Jozsef Lazar wrote:
>>   
>>> 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.
>>>     
>>
>> 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:
>>
>> http://www.xenomai.org/documentation/xenomai-2.4/html/api/group__posix__time.html#ga9ce6a1ed91a601dee133c8b6cf8b721a
>>
>> 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.

-- 
                                          Gilles



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-09 14:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-09 12:55 [Xenomai-help] Waiting w/o burning CPU Jozsef Lazar
2009-12-09 13:41 ` Gilles Chanteperdrix
     [not found]   ` <4B1FACFB.2010809@domain.hid>
2009-12-09 14:07     ` Gilles Chanteperdrix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.