On Sunday 2010-03-07 17:01, Bernhard Walle wrote:
So you replaced the old DECLARE_MUTEX() (which is actually a binary semaphore as Jean mentioned) with struct semaphore. Which is not wrong, of course. But it shows that the semaphore was used as mutex, so I don't see a problem with using the new Mutex API as Jean mentioned.
You would have to check whether the sema is held in sleeping, which newmutexes are not allowed to.
So the initial mutex you want to replace is a semaphore. Just the macros are missing in RT. Okay.
include/linux/mutex.h: #define DEFINE_MUTEX(mutexname) \ struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
Okay, Jean was proposing a 'struct mutex'. I was not talking about a rt_mutex (the spinlock replacement). If there's a 3rd mutex flavour ('newmutex') I'm not aware of, please enlight me.
"new mutex" is just the "new mutex api" you mentioned up above. - "old mutexes", better known as semaphores used with binary semantics - new mutexes, aka the 2.6.16-introduced struct mutex
Even the RT patch itself does
-static DECLARE_MUTEX(console_sem); +static DEFINE_MUTEX(console_mutex);
I would wonder if that mutex wouldn't be held while a task sleeps.
DEFINE_MUTEX is still a semaphore, so it could in theory. -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org