Browse Source

New LockAllMemory and UnlockAllMemory functions.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1382 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.62
sletz 19 years ago
parent
commit
acfc27db93
3 changed files with 29 additions and 1 deletions
  1. +6
    -0
      ChangeLog
  2. +18
    -0
      common/JackShmMem.cpp
  3. +5
    -1
      common/JackShmMem.h

+ 6
- 0
ChangeLog View File

@@ -2,6 +2,12 @@
Jackdmp changes log
---------------------------


2007-01-30 Stephane Letz <letz@grame.fr>

* New LockAllMemory and UnlockAllMemory functions.


2007-01-29 Stephane Letz <letz@grame.fr>

* More robust activation/deactivation code, especially in case of client crash.


+ 18
- 0
common/JackShmMem.cpp View File

@@ -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


+ 5
- 1
common/JackShmMem.h View File

@@ -32,11 +32,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <windows.h>
#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 <sys/types.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_MLOCKALL() (mlockall(MCL_CURRENT | MCL_FUTURE) == 0)
#define CHECK_MUNLOCKALL() (munlockall() == 0)
#endif
namespace Jack


Loading…
Cancel
Save