Re: How to sleep a kernel thread?

From: Russell King (rmk@arm.linux.org.uk)
Date: Sat Jun 03 2000 - 03:22:14 EST


Matthew Dharm writes:
> Spinlocks can give me mutual exclusion, but what I need to do is sleep
> until there is something in the queue to process. This is a textbook
> application of semaphores -- or is the kernel implementation of semaphores
> not so textbook?

Use wait queues. They have both non-interruptible and interruptible
versions. The interruptible version uses TASK_INTERRUPTIBLE, which
won't be counted as a running process.
   _____
  |_____| ------------------------------------------------- ---+---+-
  | | Russell King rmk@arm.linux.org.uk --- ---
  | | | | http://www.arm.linux.org.uk/~rmk/aboutme.html / / |
  | +-+-+ --- -+-
  / | THE developer of ARM Linux |+| /|\
 / | | | --- |
    +-+-+ ------------------------------------------------- /\\\ |

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jun 07 2000 - 21:00:16 EST