Changeset 5b303ba in mainline for kernel/generic/src/printf/vprintf.c


Ignore:
Timestamp:
2007-04-07T17:57:07Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3dbe2d1f
Parents:
be66dee
Message:

use spinlock only on console output, not other print functions
cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/printf/vprintf.c

    rbe66dee r5b303ba  
    3636#include <printf/printf_core.h>
    3737#include <putchar.h>
     38#include <synch/spinlock.h>
     39#include <arch/asm.h>
     40
     41SPINLOCK_INITIALIZE(printf_lock);                       /**< vprintf spinlock */
    3842
    3943static int vprintf_write(const char *str, size_t count, void *unused)
     
    5660{
    5761        struct printf_spec ps = {(int(*)(void *, size_t, void *)) vprintf_write, NULL};
    58         return printf_core(fmt, &ps, ap);
    59 
     62       
     63        int irqpri = interrupts_disable();
     64        spinlock_lock(&printf_lock);
     65       
     66        int ret = printf_core(fmt, &ps, ap);
     67       
     68        spinlock_unlock(&printf_lock);
     69        interrupts_restore(irqpri);
     70       
     71        return ret;
    6072}
    6173
Note: See TracChangeset for help on using the changeset viewer.