From mboxrd@z Thu Jan 1 00:00:00 1970 From: anupam.kapoor@gmail.com (Anupam Kapoor) Date: Wed, 20 Jan 2016 11:50:24 +0530 Subject: how to use wait_event_interruptible_timeout with less than 1 jiffie timeout? In-Reply-To: References: Message-ID: <87d1swsrfb.fsf@fatcat.parallelwireless> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org >>>>> [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