Commit f88240ce authored by sletz's avatar sletz
Browse files

Cleanup JackMachPort class

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2120 0c269be4-1314-0410-8aa9-9f06e86f4224
parent bf82667f
......@@ -9,7 +9,7 @@
<key>CFBundleGetInfoString</key>
<string>Jackdmp 0.71, @03-08 Paul Davis, Grame</string>
<key>CFBundleIdentifier</key>
<string>com.grame. Jackservermp</string>
<string>com.grame.Jackmp</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
......
......@@ -29,7 +29,7 @@ This program is free software; you can redistribute it and/or modify
namespace Jack
{
JackMachClientChannel::JackMachClientChannel()
JackMachClientChannel::JackMachClientChannel():fPrivatePort(0)
{
fThread = new JackMachThread(this);
}
......@@ -100,10 +100,11 @@ void JackMachClientChannel::Close()
fServerPort.DisconnectPort();
fClientPort.DestroyPort();
// TO CHECK
kern_return_t res;
if ((res = mach_port_destroy(mach_task_self(), fPrivatePort)) != KERN_SUCCESS) {
jack_error("JackMachClientChannel::Close err = %s", mach_error_string(res));
if (fPrivatePort != 0) {
kern_return_t res;
if ((res = mach_port_destroy(mach_task_self(), fPrivatePort)) != KERN_SUCCESS) {
jack_error("JackMachClientChannel::Close err = %s", mach_error_string(res));
}
}
}
......
......@@ -102,14 +102,18 @@ bool JackMachPort::DisconnectPort()
kern_return_t res;
mach_port_t task = mach_task_self();
if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
jack_error("JackMacRPC::DisconnectPort mach_port_deallocate fBootPort err = %s", mach_error_string(res));
if (fBootPort != 0) {
if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
jack_error("JackMacRPC::DisconnectPort mach_port_deallocate fBootPort err = %s", mach_error_string(res));
}
}
if ((res = mach_port_deallocate(task, fServerPort)) != KERN_SUCCESS) {
jack_error("JackMacRPC::DisconnectPort mach_port_deallocate fServerPort err = %s", mach_error_string(res));
if (fServerPort != 0) {
if ((res = mach_port_deallocate(task, fServerPort)) != KERN_SUCCESS) {
jack_error("JackMacRPC::DisconnectPort mach_port_deallocate fServerPort err = %s", mach_error_string(res));
}
}
return true;
}
......@@ -119,12 +123,16 @@ bool JackMachPort::DestroyPort()
kern_return_t res;
mach_port_t task = mach_task_self();
if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
jack_error("JackMacRPC::DisconnectPort mach_port_deallocate fBootPort err = %s", mach_error_string(res));
if (fBootPort != 0) {
if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
jack_error("JackMacRPC::DisconnectPort mach_port_deallocate fBootPort err = %s", mach_error_string(res));
}
}
if ((res = mach_port_destroy(task, fServerPort)) != KERN_SUCCESS) {
jack_error("JackMacRPC::DisconnectPort mach_port_destroy fServerPort err = %s", mach_error_string(res));
if (fServerPort != 0) {
if ((res = mach_port_destroy(task, fServerPort)) != KERN_SUCCESS) {
jack_error("JackMacRPC::DisconnectPort mach_port_destroy fServerPort err = %s", mach_error_string(res));
}
}
return true;
......@@ -180,7 +188,7 @@ bool JackMachPortSet::AllocatePort(const char* name, int queue)
jack_log("AllocatePort: queue limit = %ld", qlimits.mpl_qlimit);
if (queue > 0 ) {
if (queue > 0) {
qlimits.mpl_qlimit = queue;
if ((res = mach_port_set_attributes(task, fServerPort, MACH_PORT_LIMITS_INFO, (mach_port_info_t) & qlimits, MACH_PORT_LIMITS_INFO_COUNT)) != KERN_SUCCESS) {
......@@ -205,12 +213,16 @@ bool JackMachPortSet::DisconnectPort()
jack_log("JackMachPortSet::DisconnectPort");
if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
jack_error("JackMachPortSet::DisconnectPort mach_port_deallocate fBootPort err = %s", mach_error_string(res));
if (fBootPort != 0) {
if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
jack_error("JackMachPortSet::DisconnectPort mach_port_deallocate fBootPort err = %s", mach_error_string(res));
}
}
if ((res = mach_port_deallocate(task, fServerPort)) != KERN_SUCCESS) {
jack_error("JackMachPortSet::DisconnectPort mach_port_deallocate fServerPort err = %s", mach_error_string(res));
if (fServerPort != 0) {
if ((res = mach_port_deallocate(task, fServerPort)) != KERN_SUCCESS) {
jack_error("JackMachPortSet::DisconnectPort mach_port_deallocate fServerPort err = %s", mach_error_string(res));
}
}
return true;
......@@ -223,12 +235,16 @@ bool JackMachPortSet::DestroyPort()
jack_log("JackMachPortSet::DisconnectPort");
if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
jack_error("JackMachPortSet::DisconnectPort mach_port_deallocate err = %s", mach_error_string(res));
if (fBootPort != 0) {
if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
jack_error("JackMachPortSet::DisconnectPort mach_port_deallocate err = %s", mach_error_string(res));
}
}
if ((res = mach_port_destroy(task, fServerPort)) != KERN_SUCCESS) {
jack_error("JackMachPortSet::DisconnectPort mach_port_destroy fServerPort err = %s", mach_error_string(res));
if (fServerPort != 0) {
if ((res = mach_port_destroy(task, fServerPort)) != KERN_SUCCESS) {
jack_error("JackMachPortSet::DisconnectPort mach_port_destroy fServerPort err = %s", mach_error_string(res));
}
}
return true;
......
......@@ -43,7 +43,7 @@ class JackMachPort
public:
JackMachPort()
JackMachPort():fBootPort(0), fServerPort(0)
{}
virtual ~JackMachPort()
{}
......@@ -69,7 +69,7 @@ class JackMachPortSet : public JackMachPort
public:
JackMachPortSet()
JackMachPortSet():fPortSet(0)
{}
virtual ~JackMachPortSet()
{}
......
......@@ -1000,7 +1000,7 @@
4B2C28F908DAD01E00249230 /* JackGlobals.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackGlobals.cpp; path = ../common/JackGlobals.cpp; sourceTree = SOURCE_ROOT; };
4B35C4250D4731D1000DE7AE /* jackdmp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jackdmp; sourceTree = BUILT_PRODUCTS_DIR; };
4B35C4830D4731D1000DE7AE /* Jackmp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jackmp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4B35C4FC0D4731D1000DE7AE /* Jackdmp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jackdmp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jackservermp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4B35C5080D4731D1000DE7AE /* Jackwrapper.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jackwrapper.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4B35C5140D4731D1000DE7AE /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; };
4B35C5200D4731D1000DE7AE /* jack_midisine */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midisine; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -1034,10 +1034,10 @@
4B4259E5076B635E00C1ECE1 /* JackMacEngineRPC.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMacEngineRPC.cpp; sourceTree = SOURCE_ROOT; };
4B44FAE50C7598370033A72C /* JackServerLaunch.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackServerLaunch.cpp; path = ../common/JackServerLaunch.cpp; sourceTree = SOURCE_ROOT; };
4B464301076CAC7700E5077C /* Jack-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = "Jack-Info.plist"; sourceTree = SOURCE_ROOT; };
4B51752F0D8FE69300961F37 /* jack_thread_wait */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_thread_wait; sourceTree = BUILT_PRODUCTS_DIR; };
4B51752F0D8FE69300961F37 /* jack_thread_wait1 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_thread_wait1; sourceTree = BUILT_PRODUCTS_DIR; };
4B56880F08B5C8620022B32D /* JackFifo.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackFifo.cpp; path = ../common/JackFifo.cpp; sourceTree = SOURCE_ROOT; };
4B56881008B5C8620022B32D /* JackFifo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackFifo.h; path = ../common/JackFifo.h; sourceTree = SOURCE_ROOT; };
4B57F5950D72C27900B4E719 /* jack_thread_wait */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_thread_wait; sourceTree = BUILT_PRODUCTS_DIR; };
4B57F5950D72C27900B4E719 /* jack_thread_wait1 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_thread_wait1; sourceTree = BUILT_PRODUCTS_DIR; };
4B57F5BA0D72C2B000B4E719 /* tw1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tw1.c; path = "../example-clients/tw1.c"; sourceTree = SOURCE_ROOT; };
4B5A1BBB0CD1CB9E0005BF74 /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; };
4B5A1BBD0CD1CC110005BF74 /* midiseq.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = midiseq.c; path = "../example-clients/midiseq.c"; sourceTree = SOURCE_ROOT; };
......@@ -1105,7 +1105,7 @@
4BA692B20CBE4C2D00EAD520 /* ipload.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ipload.c; path = "../example-clients/ipload.c"; sourceTree = SOURCE_ROOT; };
4BA692D40CBE4C9000EAD520 /* jack_unload */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_unload; sourceTree = BUILT_PRODUCTS_DIR; };
4BA692D60CBE4CC600EAD520 /* ipunload.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ipunload.c; path = "../example-clients/ipunload.c"; sourceTree = SOURCE_ROOT; };
4BA7FEC30D8E76270017FF73 /* jack_lsp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_lsp; sourceTree = BUILT_PRODUCTS_DIR; };
4BA7FEC30D8E76270017FF73 /* jack_server_control */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_server_control; sourceTree = BUILT_PRODUCTS_DIR; };
4BA7FEC80D8E76650017FF73 /* control.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = control.c; path = "../example-clients/control.c"; sourceTree = SOURCE_ROOT; };
4BAB95B60B9E20B800A0C723 /* JackPortType.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackPortType.cpp; path = ../common/JackPortType.cpp; sourceTree = SOURCE_ROOT; };
4BAB95B70B9E20B800A0C723 /* JackPortType.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackPortType.h; path = ../common/JackPortType.h; sourceTree = SOURCE_ROOT; };
......@@ -1723,7 +1723,7 @@
4B5A1BDA0CD1CCE10005BF74 /* jack_midisine */,
4B35C4250D4731D1000DE7AE /* jackdmp */,
4B35C4830D4731D1000DE7AE /* Jackmp.framework */,
4B35C4FC0D4731D1000DE7AE /* Jackdmp.framework */,
4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */,
4B35C5080D4731D1000DE7AE /* Jackwrapper.framework */,
4B35C5140D4731D1000DE7AE /* jack_midiseq */,
4B35C5200D4731D1000DE7AE /* jack_midisine */,
......@@ -1752,9 +1752,9 @@
4B0A292D0D52108E002EFF74 /* jack_thread_wait */,
4B0A296D0D5231DC002EFF74 /* jack_mp_thread_wait */,
4B0A2A650D524AB2002EFF74 /* jack_mp_thread_wait */,
4B57F5950D72C27900B4E719 /* jack_thread_wait */,
4BA7FEC30D8E76270017FF73 /* jack_lsp */,
4B51752F0D8FE69300961F37 /* jack_thread_wait */,
4B57F5950D72C27900B4E719 /* jack_thread_wait1 */,
4BA7FEC30D8E76270017FF73 /* jack_server_control */,
4B51752F0D8FE69300961F37 /* jack_thread_wait1 */,
);
name = Products;
sourceTree = "<group>";
......@@ -2875,7 +2875,7 @@
);
name = "Jackservermp.framework 64 bits";
productName = Jack;
productReference = 4B35C4FC0D4731D1000DE7AE /* Jackdmp.framework */;
productReference = 4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */;
productType = "com.apple.product-type.framework";
};
4B35C4FE0D4731D1000DE7AE /* Jackwrapper.framework 64 bits */ = {
......@@ -3342,7 +3342,7 @@
name = "jack_thread_wait1 64 bits";
productInstallPath = /usr/local/bin;
productName = testSem;
productReference = 4B51752F0D8FE69300961F37 /* jack_thread_wait */;
productReference = 4B51752F0D8FE69300961F37 /* jack_thread_wait1 */;
productType = "com.apple.product-type.tool";
};
4B57F58B0D72C27900B4E719 /* jack_thread_wait1 */ = {
......@@ -3361,7 +3361,7 @@
name = jack_thread_wait1;
productInstallPath = /usr/local/bin;
productName = testSem;
productReference = 4B57F5950D72C27900B4E719 /* jack_thread_wait */;
productReference = 4B57F5950D72C27900B4E719 /* jack_thread_wait1 */;
productType = "com.apple.product-type.tool";
};
4B5A1BB10CD1CB9E0005BF74 /* jack_midiseq Universal */ = {
......@@ -3793,7 +3793,7 @@
name = "jack_server_control Universal";
productInstallPath = /usr/local/bin;
productName = jack_lsp;
productReference = 4BA7FEC30D8E76270017FF73 /* jack_lsp */;
productReference = 4BA7FEC30D8E76270017FF73 /* jack_server_control */;
productType = "com.apple.product-type.tool";
};
4BD623ED0CBCF0F000DE782F /* inprocess */ = {
......
Supports Markdown
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