Commit 6de557c7 authored by Hanspeter Portner's avatar Hanspeter Portner

m(un)lock DSP data.

parent 28ed8894
......@@ -210,10 +210,11 @@ moony_vm_mem_alloc(size_t size)
area = _aligned_malloc(size, 8);
#else
posix_memalign(&area, 8, size);
if(area)
mlock(area, size);
#endif
if(!area)
return NULL;
mlock(area, size);
return area;
}
......@@ -226,9 +227,7 @@ moony_vm_mem_free(void *area, size_t size)
//printf("moony_vm_mem_free: %zu\n", size);
#if !defined(_WIN32)
munlock(area, size);
#endif
free(area);
}
......
......@@ -23,6 +23,13 @@
#include <stdint.h>
#include <stdatomic.h>
#if !defined(_WIN32)
# include <sys/mman.h>
#else
# define mlock(...)
# define munlock(...)
#endif
#include <lv2/lv2plug.in/ns/ext/atom/atom.h>
#include <lv2/lv2plug.in/ns/ext/atom/util.h>
#include <lv2/lv2plug.in/ns/ext/atom/forge.h>
......
......@@ -44,6 +44,7 @@ instantiate(const LV2_Descriptor* descriptor, double rate, const char *bundle_pa
Handle *handle = (Handle *)calloc(1, sizeof(Handle));
if(!handle)
return NULL;
mlock(handle, sizeof(Handle));
if(moony_init(&handle->moony, descriptor->URI, rate, features))
{
......@@ -189,6 +190,7 @@ cleanup(LV2_Handle instance)
Handle *handle = (Handle *)instance;
moony_deinit(&handle->moony);
munlock(handle, sizeof(Handle));
free(handle);
}
......
......@@ -46,6 +46,7 @@ instantiate(const LV2_Descriptor* descriptor, double rate, const char *bundle_pa
Handle *handle = (Handle *)calloc(1, sizeof(Handle));
if(!handle)
return NULL;
mlock(handle, sizeof(Handle));
if(moony_init(&handle->moony, descriptor->URI, rate, features))
{
......@@ -194,6 +195,7 @@ cleanup(LV2_Handle instance)
Handle *handle = (Handle *)instance;
moony_deinit(&handle->moony);
munlock(handle, sizeof(Handle));
free(handle);
}
......
......@@ -42,6 +42,7 @@ instantiate(const LV2_Descriptor* descriptor, double rate, const char *bundle_pa
Handle *handle = (Handle *)calloc(1, sizeof(Handle));
if(!handle)
return NULL;
mlock(handle, sizeof(Handle));
if(moony_init(&handle->moony, descriptor->URI, rate, features))
{
......@@ -161,6 +162,7 @@ cleanup(LV2_Handle instance)
Handle *handle = (Handle *)instance;
moony_deinit(&handle->moony);
munlock(handle, sizeof(Handle));
free(handle);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment