Re: How to sleep a kernel thread?

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

  • Next message: Alexander Viro: "Re: Loopback (dir->dir) mounting (NOT -o loop)"

    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 : Sat Jun 03 2000 - 05:31:19 EDT