[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PowerPC exceptions and interrupts
- Date: Wed, 21 May 2008 09:49:18 +0200
- From: Sebastian.Huber at embedded-brains.de (Sebastian Huber)
- Subject: PowerPC exceptions and interrupts
Till Straumann wrote:
> [...]
> Another thing that rang my bells was the
> lazy-init of the 'bsp_interrupt_mutex' which
> is not thread safe in its current form. I do
> these e.g., like this:
>
Bad mistake. At first I created the mutex in bsp_interrupt_initialize()
but I was not sure when it is save to call rtems_semaphore_create().
> if ( ! mutex ) {
> tmp_mutex = create_mutex();
> irq_disable();
> if ( !mutex ) {
> mutex = tmp_mutex;
> irq_enable();
> } else {
> /* somebody else won */
> irq_enable();
> destroy_mutex(tmp_mutex);
> }
> }
> take_mutex(mutex);
> [...]
Nice.
--
embedded brains GmbH
Sebastian Huber Obere Lagerstr. 30
D-82178 Puchheim Germany
Tel. : +49-89-18 90 80 79-6
Fax : +49-89-18 90 80 79-9
email: Sebastian.Huber at embedded-brains.de
PGP public key available on request
Diese Nachricht ist keine gesch?ftliche Mitteilung im Sinne des EHUG.