Re: Wait for two clock ticks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 6, 2009 at 8:17 PM, Asim <linkasim@xxxxxxxxx> wrote:
> I need it for a device. The device performs some operation in a loop
> but I cannot wait in that loop forever, so I need to wait for the
> maximum time I can (2 clock ticks) before giving up on the device.
> Interrupts may be disabled so I cannot use jiffies. Any simple
> solution would be appreciated.
so why not use getnstimeofday ?

> Regards,
> Asim
>
> On 3/6/09, Raz <raziebe@xxxxxxxxx> wrote:
>> I implemented a timer that can operate without interrupts. but it
>> relies on smp or smt.
>> what do you need it for ?
>>
>> On Fri, Mar 6, 2009 at 5:08 PM, Greg Freemyer <greg.freemyer@xxxxxxxxx>
>> wrote:
>>> On Fri, Mar 6, 2009 at 9:59 AM, Asim <linkasim@xxxxxxxxx> wrote:
>>>> Yes - Actually I need to wait for a device to finish something after
>>>> which I(device) error out. Ideally, I would like a simple
>>>> function using the standard apis that works on most kernels. I cannot
>>>> use jiffies as I mentioned earlier. Still working on it.
>>>>
>>>> -Asim
>>>
>>> In general the idea of waiting 2 whole ticks with interrupts disabled
>>> is such a bad idea that I don't think you will find a pre-existing API
>>> to do that.
>>>
>>> You definitely will not be able to simply check a variable because
>>> with interrupts disabled, their is no one to update the variable.
>>>
>>> If you really need this, you will likely need a call into a routine
>>> the gets the current time from a hardware clock.
>>>
>>> IMHO, such misbehaving code will never get into mainline and is not
>>> even a good learning experience.
>>>
>>> Greg
>>> --
>>> Greg Freemyer
>>> Litigation Triage Solutions Specialist
>>> http://www.linkedin.com/in/gregfreemyer
>>> First 99 Days Litigation White Paper -
>>> http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf
>>>
>>> The Norcross Group
>>> The Intersection of Evidence & Technology
>>> http://www.norcrossgroup.com
>>>
>>> --
>>> To unsubscribe from this list: send an email with
>>> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
>>> Please read the FAQ at http://kernelnewbies.org/FAQ
>>>
>>>
>>
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux