Is there a primitive to atomically release a spinlock and go to sleep?

From: David Nicol
Date: Wed Sep 01 2010 - 21:04:49 EST


I'm trying to do something involving multiple kthreads in an ioctl
handler, and I want to avoid the
race condition between the third and fourth steps of

acquire mutex
add &self to a list of threads which will get awakened by
something else that is also aware of this list
release mutex
go to sleep

Is there a standard atomic go-to-sleep function that takes as a
parameter a pointer to spinlock to release after its state is set to
TASK_INTERRUPTIBLE?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/