Skip to content
Snippets Groups Projects
  • Avi Kivity's avatar
    3d435cc9
    mutex: add with_lock() function · 3d435cc9
    Avi Kivity authored
    This function allows executing a block of code under a lock, with a guarantee
    that any exit from the block will release the lock.
    
    Examples:
    
        with_lock(my_mutex, [&] { a += b; });
    
        return with_lock(my_spinlock, [&] {
            return my_list.size();
        });
    3d435cc9
    History
    mutex: add with_lock() function
    Avi Kivity authored
    This function allows executing a block of code under a lock, with a guarantee
    that any exit from the block will release the lock.
    
    Examples:
    
        with_lock(my_mutex, [&] { a += b; });
    
        return with_lock(my_spinlock, [&] {
            return my_list.size();
        });
mutex.hh 298 B