title: wakeup a kernel thread that is in sleep using msleep
body: <p>I have created and started a kernel thread using "kthread_run". 
      task1 = kthread_run(flash, NULL, "LED_thread");
  I have to basically blink an LED in 4 different patterns with different on off times. I am using "msleep" for this. For example if in a pattern, the off time is 10 seconds, i switch off the led and then use a "msleep(10000)". Now the problem is if the pattern is changed from user space, the pattern changes only after this delay of 10seconds is completed.</p>
  
  <p>In order to solve i have started a second thread which monitors the pattern of the LED and as soon as it sees a change in the pattern, it tries to wakeup the first thread using "wake_up_process(task1)"</p>
  
  <p>But this doesnot wake up the first thread.</p>
  
  <p>So my question is does:
  1. wake_up_process wakeup a thread in sleep (sheduled away from run queue)?
  2. if it doesnot, is there any other of acccomplishing this.</p>
  
  <p>Thanks in advance
  Srik</p>
  
  <p>In my "flash" thread function, i have </p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p><strong>@Craig</strong>, its a nice example you gave to implement the whole thing in a single thread. In my opinion threads hog a lot of cpu cycles, so it is better to have as less threads as possible. Do you agree on that?<br>
  Alternative besides your example of avoiding the other thread is:<br>
  1. to use ioctl in the driver and to set the mode from user space using this ioctl instead of the sysfs attribute i was using and send the signal to the worker thread to wake it up, when the ioctl command is received.<br>
  2. send the signal to wake up the worker thread in the store function of the mode sysfs attribute (function in the driver which will be called when the mode is set in user space)  </p>