|
|
@@ -151,6 +151,7 @@ class JackShmReadWritePtr |
|
|
private: |
|
|
private: |
|
|
|
|
|
|
|
|
jack_shm_info_t fInfo; |
|
|
jack_shm_info_t fInfo; |
|
|
|
|
|
bool fInitDone; |
|
|
|
|
|
|
|
|
void Init(int index, const char* server_name = JACK_DEFAULT_SERVER_NAME) |
|
|
void Init(int index, const char* server_name = JACK_DEFAULT_SERVER_NAME) |
|
|
{ |
|
|
{ |
|
|
@@ -164,6 +165,7 @@ class JackShmReadWritePtr |
|
|
throw std::bad_alloc(); |
|
|
throw std::bad_alloc(); |
|
|
} |
|
|
} |
|
|
GetShmAddress()->LockMemory(); |
|
|
GetShmAddress()->LockMemory(); |
|
|
|
|
|
fInitDone = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -172,6 +174,7 @@ class JackShmReadWritePtr |
|
|
JackShmReadWritePtr() |
|
|
JackShmReadWritePtr() |
|
|
{ |
|
|
{ |
|
|
fInfo.index = -1; |
|
|
fInfo.index = -1; |
|
|
|
|
|
fInitDone = false; |
|
|
fInfo.ptr.attached_at = (char*)NULL; |
|
|
fInfo.ptr.attached_at = (char*)NULL; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -182,6 +185,10 @@ class JackShmReadWritePtr |
|
|
|
|
|
|
|
|
~JackShmReadWritePtr() |
|
|
~JackShmReadWritePtr() |
|
|
{ |
|
|
{ |
|
|
|
|
|
if (!fInitDone) { |
|
|
|
|
|
jack_error("JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for %ld, skipping unlock", fInfo.index); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
if (fInfo.index >= 0) { |
|
|
if (fInfo.index >= 0) { |
|
|
jack_log("JackShmReadWritePtr::~JackShmReadWritePtr %ld", fInfo.index); |
|
|
jack_log("JackShmReadWritePtr::~JackShmReadWritePtr %ld", fInfo.index); |
|
|
GetShmAddress()->UnlockMemory(); |
|
|
GetShmAddress()->UnlockMemory(); |
|
|
@@ -233,6 +240,7 @@ class JackShmReadWritePtr1 |
|
|
private: |
|
|
private: |
|
|
|
|
|
|
|
|
jack_shm_info_t fInfo; |
|
|
jack_shm_info_t fInfo; |
|
|
|
|
|
bool fInitDone; |
|
|
|
|
|
|
|
|
void Init(int index, const char* server_name = JACK_DEFAULT_SERVER_NAME) |
|
|
void Init(int index, const char* server_name = JACK_DEFAULT_SERVER_NAME) |
|
|
{ |
|
|
{ |
|
|
@@ -246,6 +254,7 @@ class JackShmReadWritePtr1 |
|
|
throw std::bad_alloc(); |
|
|
throw std::bad_alloc(); |
|
|
} |
|
|
} |
|
|
GetShmAddress()->LockMemory(); |
|
|
GetShmAddress()->LockMemory(); |
|
|
|
|
|
fInitDone = true; |
|
|
/* |
|
|
/* |
|
|
nobody else needs to access this shared memory any more, so |
|
|
nobody else needs to access this shared memory any more, so |
|
|
destroy it. because we have our own attachment to it, it won't |
|
|
destroy it. because we have our own attachment to it, it won't |
|
|
@@ -260,6 +269,7 @@ class JackShmReadWritePtr1 |
|
|
JackShmReadWritePtr1() |
|
|
JackShmReadWritePtr1() |
|
|
{ |
|
|
{ |
|
|
fInfo.index = -1; |
|
|
fInfo.index = -1; |
|
|
|
|
|
fInitDone = false; |
|
|
fInfo.ptr.attached_at = NULL; |
|
|
fInfo.ptr.attached_at = NULL; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -270,6 +280,10 @@ class JackShmReadWritePtr1 |
|
|
|
|
|
|
|
|
~JackShmReadWritePtr1() |
|
|
~JackShmReadWritePtr1() |
|
|
{ |
|
|
{ |
|
|
|
|
|
if (!fInitDone) { |
|
|
|
|
|
jack_error("JackShmReadWritePtr1::~JackShmReadWritePtr1 - Init not done for %ld, skipping unlock", fInfo.index); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
if (fInfo.index >= 0) { |
|
|
if (fInfo.index >= 0) { |
|
|
jack_log("JackShmReadWritePtr1::~JackShmReadWritePtr1 %ld", fInfo.index); |
|
|
jack_log("JackShmReadWritePtr1::~JackShmReadWritePtr1 %ld", fInfo.index); |
|
|
GetShmAddress()->UnlockMemory(); |
|
|
GetShmAddress()->UnlockMemory(); |
|
|
@@ -321,6 +335,7 @@ class JackShmReadPtr |
|
|
private: |
|
|
private: |
|
|
|
|
|
|
|
|
jack_shm_info_t fInfo; |
|
|
jack_shm_info_t fInfo; |
|
|
|
|
|
bool fInitDone; |
|
|
|
|
|
|
|
|
void Init(int index, const char* server_name = JACK_DEFAULT_SERVER_NAME) |
|
|
void Init(int index, const char* server_name = JACK_DEFAULT_SERVER_NAME) |
|
|
{ |
|
|
{ |
|
|
@@ -334,6 +349,7 @@ class JackShmReadPtr |
|
|
throw std::bad_alloc(); |
|
|
throw std::bad_alloc(); |
|
|
} |
|
|
} |
|
|
GetShmAddress()->LockMemory(); |
|
|
GetShmAddress()->LockMemory(); |
|
|
|
|
|
fInitDone = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -342,6 +358,7 @@ class JackShmReadPtr |
|
|
JackShmReadPtr() |
|
|
JackShmReadPtr() |
|
|
{ |
|
|
{ |
|
|
fInfo.index = -1; |
|
|
fInfo.index = -1; |
|
|
|
|
|
fInitDone = false; |
|
|
fInfo.ptr.attached_at = NULL; |
|
|
fInfo.ptr.attached_at = NULL; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -352,6 +369,10 @@ class JackShmReadPtr |
|
|
|
|
|
|
|
|
~JackShmReadPtr() |
|
|
~JackShmReadPtr() |
|
|
{ |
|
|
{ |
|
|
|
|
|
if (!fInitDone) { |
|
|
|
|
|
jack_error("JackShmReadPtr::~JackShmReadPtr - Init not done for %ld, skipping unlock", fInfo.index); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
if (fInfo.index >= 0) { |
|
|
if (fInfo.index >= 0) { |
|
|
jack_log("JackShmPtrRead::~JackShmPtrRead %ld", fInfo.index); |
|
|
jack_log("JackShmPtrRead::~JackShmPtrRead %ld", fInfo.index); |
|
|
GetShmAddress()->UnlockMemory(); |
|
|
GetShmAddress()->UnlockMemory(); |
|
|
|