Skip to content
Snippets Groups Projects
  • Nadav Har'El's avatar
    3c692eaa
    Unify "mutex_t" and "mutex" types · 3c692eaa
    Nadav Har'El authored
    Previously we had two different mutex types - "mutex_t" defined by
    <osv/mutex.h> for use in C code, and "mutex" defined by <mutex.hh>
    for use in C++ code. This is difference is unnecessary, and causes
    a mess for functions that need to accept either type, so they work
    for both C++ and C code (e.g., consider condvar_wait()).
    
    So after this commit, we have just one include file, <osv/mutex.h>
    which works both in C and C++ code. This results in the same type
    and same functions being defined, plus some additional conveniences
    when in C++, such as method variants of the functions (e.g.,
    m.lock() in addition to mutex_lock(m)), and the "with_lock" function.
    
    The mutex type is now called either "mutex_t" or "struct mutex" in
    C code, or can also be called just "mutex" in C++ code (all three
    names refer to an identical type - there's no longer a different
    mutex_t and mutex type).
    
    This commit also modifies all the includers of <mutex.hh> to use
    <osv/mutex.h>, and fixes a few miscelleneous compilation issues
    that were discovered in the process.
    3c692eaa
    History
    Unify "mutex_t" and "mutex" types
    Nadav Har'El authored
    Previously we had two different mutex types - "mutex_t" defined by
    <osv/mutex.h> for use in C code, and "mutex" defined by <mutex.hh>
    for use in C++ code. This is difference is unnecessary, and causes
    a mess for functions that need to accept either type, so they work
    for both C++ and C code (e.g., consider condvar_wait()).
    
    So after this commit, we have just one include file, <osv/mutex.h>
    which works both in C and C++ code. This results in the same type
    and same functions being defined, plus some additional conveniences
    when in C++, such as method variants of the functions (e.g.,
    m.lock() in addition to mutex_lock(m)), and the "with_lock" function.
    
    The mutex type is now called either "mutex_t" or "struct mutex" in
    C code, or can also be called just "mutex" in C++ code (all three
    names refer to an identical type - there's no longer a different
    mutex_t and mutex type).
    
    This commit also modifies all the includers of <mutex.hh> to use
    <osv/mutex.h>, and fixes a few miscelleneous compilation issues
    that were discovered in the process.