summaryrefslogtreecommitdiff
path: root/common/JackShmMem.h
diff options
context:
space:
mode:
authorsletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224>2009-11-13 19:04:51 +0000
committersletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224>2009-11-13 19:04:51 +0000
commit9e263b52ac1de3a8042a1c3d304d56ea12fcf242 (patch)
tree0d8f19c1769df0afdb5811da1312600f11c09d3d /common/JackShmMem.h
parent5dc57dd09073435722c45b1e35dfcc0bf9ad74aa (diff)
downloadjack2-9e263b52ac1de3a8042a1c3d304d56ea12fcf242.tar.gz
Lock/Unlock shared memory segments (to test...).
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3788 0c269be4-1314-0410-8aa9-9f06e86f4224
Diffstat (limited to 'common/JackShmMem.h')
-rw-r--r--common/JackShmMem.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/common/JackShmMem.h b/common/JackShmMem.h
index 5976c96d..816ed4cd 100644
--- a/common/JackShmMem.h
+++ b/common/JackShmMem.h
@@ -129,9 +129,8 @@ class SERVER_EXPORT JackShmMem : public JackShmMemAble
protected:
JackShmMem();
- ~JackShmMem()
- {}
-
+ ~JackShmMem();
+
public:
void* operator new(size_t size);
@@ -162,9 +161,9 @@ class JackShmReadWritePtr
throw - 1;
fInfo.index = index;
if (jack_attach_shm(&fInfo)) {
- //jack_error("cannot attach shared memory segment", strerror(errno));
throw - 2;
}
+ static_cast<T*>(fInfo.ptr.attached_at)->LockMemory();
}
}
@@ -185,9 +184,10 @@ class JackShmReadWritePtr
{
if (fInfo.index >= 0) {
jack_log("JackShmReadWritePtr::~JackShmReadWritePtr %ld", fInfo.index);
+ static_cast<T*>(fInfo.ptr.attached_at)->UnlockMemory();
jack_release_shm(&fInfo);
fInfo.index = -1;
- }
+ }
}
T* operator->() const
@@ -242,15 +242,15 @@ class JackShmReadWritePtr1
throw - 1;
fInfo.index = index;
if (jack_attach_shm(&fInfo)) {
- //jack_error("cannot attach shared memory segment", strerror(errno));
throw - 2;
}
/*
- nobody else needs to access this shared memory any more, so
- destroy it. because we have our own attachment to it, it won't
- vanish till we exit (and release it).
- */
+ nobody else needs to access this shared memory any more, so
+ destroy it. because we have our own attachment to it, it won't
+ vanish till we exit (and release it).
+ */
jack_destroy_shm(&fInfo);
+ static_cast<T*>(fInfo.ptr.attached_at)->LockMemory();
}
}
@@ -271,6 +271,7 @@ class JackShmReadWritePtr1
{
if (fInfo.index >= 0) {
jack_log("JackShmReadWritePtr1::~JackShmReadWritePtr1 %ld", fInfo.index);
+ static_cast<T*>(fInfo.ptr.attached_at)->UnlockMemory();
jack_release_shm(&fInfo);
fInfo.index = -1;
}
@@ -328,9 +329,9 @@ class JackShmReadPtr
throw - 1;
fInfo.index = index;
if (jack_attach_shm_read(&fInfo)) {
- //jack_error("cannot attach shared memory segment", strerror(errno));
throw - 2;
}
+ static_cast<T*>(fInfo.ptr.attached_at)->LockMemory();
}
}
@@ -351,6 +352,7 @@ class JackShmReadPtr
{
if (fInfo.index >= 0) {
jack_log("JackShmPtrRead::~JackShmPtrRead %ld", fInfo.index);
+ static_cast<T*>(fInfo.ptr.attached_at)->UnlockMemory();
jack_release_shm(&fInfo);
fInfo.index = -1;
}