Skip to content
Snippets Groups Projects
  • Nadav Har'El's avatar
    8fcad509
    Exile spinlock to a separate file · 8fcad509
    Nadav Har'El authored
    
    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: default avatarNadav Har'El <nyh@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
    8fcad509
    History
    Exile spinlock to a separate file
    Nadav Har'El authored
    
    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: default avatarNadav Har'El <nyh@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>