zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

MemLocker.h (723B)


      1 /*
      2   ZynAddSubFX - a software synthesizer
      3 
      4   MemLocker.h - Memory page locker
      5   Copyright (C) 2019-2019 Johannes Lorenz
      6   Author: Johannes Lorenz
      7 
      8   This program is free software; you can redistribute it and/or
      9   modify it under the terms of the GNU General Public License
     10   as published by the Free Software Foundation; either version 2
     11   of the License, or (at your option) any later version.
     12 */
     13 
     14 namespace zyn {
     15 
     16 //! Class to lock all pages in memory
     17 class MemLocker
     18 {
     19     bool isLocked = false;
     20 public:
     21     MemLocker() = default;
     22     ~MemLocker() { unlock(); }
     23 
     24     //! try to lock all current and future pages, if not already locked
     25     void lock();
     26     //! try to unlock all pages, if locked
     27     void unlock();
     28 };
     29 
     30 }