Re: how to use wait_event_interruptible_timeout with less than 1 jiffie timeout?

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

 



>>>>> [2016-01-20T01:21:18+0530]: "Daniel." (Daniel):
,----[ Daniel ]
| I have some code that convert an timeout comming from userspace (in
| ms) to jiffies prior passing to wait_event_interrupitible_timeout().
| The code looks like this:
| 
| unsigned long tout = user.timeout * HZ / 1000; /* convert from ms to jiffie */
| int status = wait_event_interruptible_timeout(wq, cond, tout);
| 
| I'm using HZ=100, the known default.
| The problem is: with HZ = 100 and user.timeout = 10 I have:
| 10 * 100 / 1000 = 1,
| 
| This means that I can't use timeouts with less than 10ms. Is there any
| way to circunvent this without changing HZ value?
`----
wouldn't msleep_interruptible(...) be a better choice ? as a bonus, it
takes care of jiffies wrapping etc. 

-- 
kind regards
anupam

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[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