git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1382 0c269be4-1314-0410-8aa9-9f06e86f4224tags/0.62
| @@ -2,6 +2,12 @@ | |||||
| Jackdmp changes log | Jackdmp changes log | ||||
| --------------------------- | --------------------------- | ||||
| 2007-01-30 Stephane Letz <letz@grame.fr> | |||||
| * New LockAllMemory and UnlockAllMemory functions. | |||||
| 2007-01-29 Stephane Letz <letz@grame.fr> | 2007-01-29 Stephane Letz <letz@grame.fr> | ||||
| * More robust activation/deactivation code, especially in case of client crash. | * More robust activation/deactivation code, especially in case of client crash. | ||||
| @@ -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 | } // end of namespace | ||||
| @@ -32,11 +32,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||||
| #include <windows.h> | #include <windows.h> | ||||
| #define CHECK_MLOCK(ptr, size) (VirtualLock((ptr), (size)) != 0) | #define CHECK_MLOCK(ptr, size) (VirtualLock((ptr), (size)) != 0) | ||||
| #define CHECK_MUNLOCK(ptr, size) (VirtualUnlock((ptr), (size)) != 0) | #define CHECK_MUNLOCK(ptr, size) (VirtualUnlock((ptr), (size)) != 0) | ||||
| #define CHECK_MLOCKALL() | |||||
| #define CHECK_MUNLOCKALL() | |||||
| #else | #else | ||||
| #include <sys/types.h> | #include <sys/types.h> | ||||
| #include <sys/mman.h> | #include <sys/mman.h> | ||||
| #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_MUNLOCK(ptr, size) (munlock((ptr), (size)) == 0) | ||||
| #define CHECK_MLOCKALL() (mlockall(MCL_CURRENT | MCL_FUTURE) == 0) | |||||
| #define CHECK_MUNLOCKALL() (munlockall() == 0) | |||||
| #endif | #endif | ||||
| namespace Jack | namespace Jack | ||||