diff --git a/ChangeLog b/ChangeLog index af704b48..fb869209 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,12 @@ Jackdmp changes log --------------------------- + +2007-01-30 Stephane Letz + + * New LockAllMemory and UnlockAllMemory functions. + + 2007-01-29 Stephane Letz * More robust activation/deactivation code, especially in case of client crash. diff --git a/common/JackShmMem.cpp b/common/JackShmMem.cpp index 3e8412fc..7d7230fb 100644 --- a/common/JackShmMem.cpp +++ b/common/JackShmMem.cpp @@ -109,6 +109,24 @@ void UnlockMemoryImp(void* ptr, size_t size) } } +void LockAllMemory() +{ + if (CHECK_MLOCKALL()) { + JackLog("Succeeded in locking all memory\n"); + } else { + jack_error("Cannot lock down memory area (%s)", strerror(errno)); + } +} + +void UnlockAllMemory() +{ + if (CHECK_MUNLOCKALL()) { + JackLog("Succeeded in unlocking all memory\n"); + } else { + jack_error("Cannot unlock down memory area (%s)", strerror(errno)); + } +} + } // end of namespace diff --git a/common/JackShmMem.h b/common/JackShmMem.h index aeaacb51..94bd7b50 100644 --- a/common/JackShmMem.h +++ b/common/JackShmMem.h @@ -32,11 +32,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include #define CHECK_MLOCK(ptr, size) (VirtualLock((ptr), (size)) != 0) #define CHECK_MUNLOCK(ptr, size) (VirtualUnlock((ptr), (size)) != 0) + #define CHECK_MLOCKALL() + #define CHECK_MUNLOCKALL() #else #include #include - #define CHECK_MLOCK(ptr, size) (munlock((ptr), (size)) == 0) + #define CHECK_MLOCK(ptr, size) (mlock((ptr), (size)) == 0) #define CHECK_MUNLOCK(ptr, size) (munlock((ptr), (size)) == 0) + #define CHECK_MLOCKALL() (mlockall(MCL_CURRENT | MCL_FUTURE) == 0) + #define CHECK_MUNLOCKALL() (munlockall() == 0) #endif namespace Jack