From 537a1de88a2b69e27bce9eddc946851765bf97b9 Mon Sep 17 00:00:00 2001 From: sletz Date: Thu, 29 May 2008 08:44:36 +0000 Subject: [PATCH] Cleanup testMutex git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2384 0c269be4-1314-0410-8aa9-9f06e86f4224 --- macosx/Jackdmp.xcodeproj/project.pbxproj | 13 +++++++++++++ tests/testMutex.cpp | 21 ++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/macosx/Jackdmp.xcodeproj/project.pbxproj b/macosx/Jackdmp.xcodeproj/project.pbxproj index e1b0ed03..1ce0b4c3 100644 --- a/macosx/Jackdmp.xcodeproj/project.pbxproj +++ b/macosx/Jackdmp.xcodeproj/project.pbxproj @@ -73,6 +73,7 @@ 4BFA99AC0AAAF41D009E916C /* PBXTargetDependency */, 4BFA99500AAAED90009E916C /* PBXTargetDependency */, 4BFA99520AAAED90009E916C /* PBXTargetDependency */, + 4B5F25B30DEEA2430041E486 /* PBXTargetDependency */, 4BFA99540AAAED90009E916C /* PBXTargetDependency */, 4BFA99580AAAED90009E916C /* PBXTargetDependency */, 4BFA995A0AAAED90009E916C /* PBXTargetDependency */, @@ -803,6 +804,13 @@ remoteGlobalIDString = 4B5A1BD00CD1CCE10005BF74; remoteInfo = jack_midisine; }; + 4B5F25B20DEEA2430041E486 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4BFA5E8B0DEC4D9C00FA4CDB /* testMutex Universal */; + remoteInfo = "testMutex Universal"; + }; 4B699DB3097D421700A18468 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; @@ -5355,6 +5363,11 @@ target = 4B5A1BD00CD1CCE10005BF74 /* jack_midisine Universal */; targetProxy = 4B5A1BE10CD1CD730005BF74 /* PBXContainerItemProxy */; }; + 4B5F25B30DEEA2430041E486 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4BFA5E8B0DEC4D9C00FA4CDB /* testMutex Universal */; + targetProxy = 4B5F25B20DEEA2430041E486 /* PBXContainerItemProxy */; + }; 4B699DB4097D421700A18468 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 4B699C4C097D421600A18468 /* Jackservermp.framework Universal */; diff --git a/tests/testMutex.cpp b/tests/testMutex.cpp index 25fa965c..e3353ea5 100644 --- a/tests/testMutex.cpp +++ b/tests/testMutex.cpp @@ -24,7 +24,6 @@ #include #ifdef __APPLE__ -#include "JackMachSemaphore.h" #include "JackMachThread.h" #endif @@ -52,21 +51,21 @@ struct LockedObject : public JackLockAble { { JackLock lock(this); fCount++; - //printf("LockedMethod1 self %x fCount %ld\n", pthread_self(), fCount); + printf("LockedMethod1 self %x fCount %d\n", pthread_self(), fCount); } void LockedMethod2() { JackLock lock(this); fCount--; - //printf("LockedMethod2 self %x fCount %ld\n", pthread_self(), fCount); + printf("LockedMethod2 self %x fCount %d\n", pthread_self(), fCount); } void LockedMethod3() { JackLock lock(this); fCount--; - //printf("LockedMethod3 self %x fCount %ld\n", pthread_self(), fCount); + printf("LockedMethod3 self %x fCount %d\n", pthread_self(), fCount); } }; @@ -93,7 +92,7 @@ struct TestThread : public JackRunnableInterface { bool Execute() { - //printf("TestThread Execute\n"); + printf("TestThread Execute\n"); switch (fNum) { case 1: @@ -109,7 +108,7 @@ struct TestThread : public JackRunnableInterface { break; }; - //usleep(fNum * 1000); + usleep(fNum * 1000); return true; } @@ -119,11 +118,11 @@ int main (int argc, char * const argv[]) { char c; - LockedObject* obj = new LockedObject(); - TestThread* th1 = new TestThread(obj, 1); - TestThread* th2 = new TestThread(obj,3); - TestThread* th3 = new TestThread(obj, 2); + LockedObject obj; + TestThread th1(&obj, 1); + TestThread th2(&obj, 2); + TestThread th3(&obj, 3); - while ((c = getchar()) != 'q')) {} + while ((c = getchar()) != 'q') {} }