lock: merge spinlock and mtx locks into one
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
3e5abada9b
commit
2076f1dae1
32 changed files with 158 additions and 169 deletions
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
#include <drivers/serial.h>
|
||||
#include <kernel/tty.h>
|
||||
#include <kernel/spinlock.h>
|
||||
#include <kernel/lock.h>
|
||||
|
||||
// define this globally (e.g. gcc -DPRINTF_INCLUDE_CONFIG_H ...) to include the
|
||||
// printf_config.h header file
|
||||
|
|
@ -941,14 +941,14 @@ static int _vsnprintf(out_fct_type out, char *buffer, const size_t maxlen, const
|
|||
|
||||
int printf_(const char *format, ...)
|
||||
{
|
||||
static spinlock_t lock = 0;
|
||||
spinlock_acquire(&lock);
|
||||
static lock_t lock = 0;
|
||||
spin_lock(&lock);
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
char buffer[1];
|
||||
const int ret = _vsnprintf(_out_char, buffer, (size_t)-1, format, va);
|
||||
va_end(va);
|
||||
spinlock_release(&lock);
|
||||
spin_unlock(&lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue