You shouldn't sleep while holding a spinlock. As soon as another thread
attempts to take the spinlock, it will be stuck in a busy-wait loop.
So, it's better if you specify that your code either can be called in
atomic context or must not be called in atomic context, and all callers
observe this restriction. Or callers pass a flag to your code which
says whether your code is allowed to sleep or not.
--
Stefan Richter
-=====-==--- --== =-=-=
http://arcgraph.de/sr/
--