From fa24a47037adfc99fc50a3834751c597467dc1de Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Thu, 20 May 2010 16:24:24 -0400 Subject: [PATCH] Use spinlock to freeze system for 5 seconds. --- hellochar.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hellochar.c b/hellochar.c index a197a1d..180b90c 100644 --- a/hellochar.c +++ b/hellochar.c @@ -40,8 +40,10 @@ static ssize_t hello_read(struct file *fp, char __user *buf, size_t sz, loff_t *pos) { unsigned long expire = jiffies + 5 * HZ; + spin_lock(&hello_lock); while (time_after(expire, jiffies)) cpu_relax(); + spin_unlock(&hello_lock); return 0; } -- 2.20.1