-
- Downloads
Exile spinlock to a separate file
In very early OSv history, the spinlock was used in the mutex's implementation so it made sense to put it in mutex.cc and mutex.h. But now that the spinlock is all that's left in mutex.cc (the real mutex is in lfmutex.cc), rename this file spinlock.cc. Also, move the spinlock definitions from <osv/mutex.h> to a new <osv/spinlock.h>, so if someone wants to make the grave mistake of using a spinlock - they will at least need to explicitly include this header file. Currently, the only remaining user of the spinlock is the console. Using a spinlock (and not a mutex) in the console allows printing debug messages while preemption is disabled. Arguably, this use-case is no longer important (we have tracepoints), so in the future we can consider dropping the spinlock completely. Signed-off-by:Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
Showing
- core/spinlock.cc 1 addition, 5 deletionscore/spinlock.cc
- drivers/debug-console.hh 1 addition, 0 deletionsdrivers/debug-console.hh
- include/osv/mutex.h 0 additions, 32 deletionsinclude/osv/mutex.h
- include/osv/spinlock.h 47 additions, 0 deletionsinclude/osv/spinlock.h
- tests/misc-mutex.cc 1 addition, 0 deletionstests/misc-mutex.cc
Loading
Please register or sign in to comment