| @@ -103,7 +103,6 @@ OBJECTS := \ | |||
| $(OBJDIR)/juce_ValueTree_f822be84.o \ | |||
| $(OBJDIR)/juce_Variant_4f31c35a.o \ | |||
| $(OBJDIR)/juce_FileLogger_7858478e.o \ | |||
| $(OBJDIR)/juce_Initialisation_fec765a9.o \ | |||
| $(OBJDIR)/juce_Logger_4f4f7f72.o \ | |||
| $(OBJDIR)/juce_PerformanceCounter_6422080e.o \ | |||
| $(OBJDIR)/juce_RelativeTime_bc5ef35b.o \ | |||
| @@ -708,11 +707,6 @@ $(OBJDIR)/juce_FileLogger_7858478e.o: ../../src/core/juce_FileLogger.cpp | |||
| @echo "Compiling juce_FileLogger.cpp" | |||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||
| $(OBJDIR)/juce_Initialisation_fec765a9.o: ../../src/core/juce_Initialisation.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling juce_Initialisation.cpp" | |||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||
| $(OBJDIR)/juce_Logger_4f4f7f72.o: ../../src/core/juce_Logger.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling juce_Logger.cpp" | |||
| @@ -72,7 +72,6 @@ | |||
| A230949FF8848D5E923F9083 = { isa = PBXBuildFile; fileRef = 5D27EE211D9BFF6A58C4DC42; }; | |||
| 11162E9812CFB0E738A7E2E6 = { isa = PBXBuildFile; fileRef = 4DF9D333038A442870668D31; }; | |||
| C682BEA7DB70FDC7C6BA2D6E = { isa = PBXBuildFile; fileRef = D66C00E06B06EAD3B5257DD6; }; | |||
| 77104E86801B6CAD01F963F4 = { isa = PBXBuildFile; fileRef = 5B789AAC295BA4BB6D5AD4A3; }; | |||
| 6A53DA58B55E2DE7241BF2C8 = { isa = PBXBuildFile; fileRef = 4555F03DBD059EEDECEF9F85; }; | |||
| 0FF71870483AC46D5B7AC5B0 = { isa = PBXBuildFile; fileRef = DF6CAC67C0F2D379BDA03062; }; | |||
| FA01B3EABA192AE041D4FE4D = { isa = PBXBuildFile; fileRef = CFAECB6551F48A1695DEC243; }; | |||
| @@ -536,7 +535,6 @@ | |||
| A81B4FC81A75E21E5B96E506 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Variant.h"; path = "../../src/containers/juce_Variant.h"; sourceTree = "SOURCE_ROOT"; }; | |||
| D66C00E06B06EAD3B5257DD6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_FileLogger.cpp"; path = "../../src/core/juce_FileLogger.cpp"; sourceTree = "SOURCE_ROOT"; }; | |||
| C8441B7B3E4CCD4A257B4BFE = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_FileLogger.h"; path = "../../src/core/juce_FileLogger.h"; sourceTree = "SOURCE_ROOT"; }; | |||
| 5B789AAC295BA4BB6D5AD4A3 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Initialisation.cpp"; path = "../../src/core/juce_Initialisation.cpp"; sourceTree = "SOURCE_ROOT"; }; | |||
| 92ACFFCCCD1C85A0F8C6F80F = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Initialisation.h"; path = "../../src/core/juce_Initialisation.h"; sourceTree = "SOURCE_ROOT"; }; | |||
| 4555F03DBD059EEDECEF9F85 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Logger.cpp"; path = "../../src/core/juce_Logger.cpp"; sourceTree = "SOURCE_ROOT"; }; | |||
| 63F44EC0485FCA050814967E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Logger.h"; path = "../../src/core/juce_Logger.h"; sourceTree = "SOURCE_ROOT"; }; | |||
| @@ -1317,7 +1315,6 @@ | |||
| 1AF37A533ABDD889670F9349 = { isa = PBXGroup; children = ( | |||
| D66C00E06B06EAD3B5257DD6, | |||
| C8441B7B3E4CCD4A257B4BFE, | |||
| 5B789AAC295BA4BB6D5AD4A3, | |||
| 92ACFFCCCD1C85A0F8C6F80F, | |||
| 4555F03DBD059EEDECEF9F85, | |||
| 63F44EC0485FCA050814967E, | |||
| @@ -2135,7 +2132,6 @@ | |||
| A230949FF8848D5E923F9083, | |||
| 11162E9812CFB0E738A7E2E6, | |||
| C682BEA7DB70FDC7C6BA2D6E, | |||
| 77104E86801B6CAD01F963F4, | |||
| 6A53DA58B55E2DE7241BF2C8, | |||
| 0FF71870483AC46D5B7AC5B0, | |||
| FA01B3EABA192AE041D4FE4D, | |||
| @@ -366,7 +366,6 @@ | |||
| <Filter Name="core"> | |||
| <File RelativePath="..\..\src\core\juce_FileLogger.cpp"/> | |||
| <File RelativePath="..\..\src\core\juce_FileLogger.h"/> | |||
| <File RelativePath="..\..\src\core\juce_Initialisation.cpp"/> | |||
| <File RelativePath="..\..\src\core\juce_Initialisation.h"/> | |||
| <File RelativePath="..\..\src\core\juce_Logger.cpp"/> | |||
| <File RelativePath="..\..\src\core\juce_Logger.h"/> | |||
| @@ -366,7 +366,6 @@ | |||
| <Filter Name="core"> | |||
| <File RelativePath="..\..\src\core\juce_FileLogger.cpp"/> | |||
| <File RelativePath="..\..\src\core\juce_FileLogger.h"/> | |||
| <File RelativePath="..\..\src\core\juce_Initialisation.cpp"/> | |||
| <File RelativePath="..\..\src\core\juce_Initialisation.h"/> | |||
| <File RelativePath="..\..\src\core\juce_Logger.cpp"/> | |||
| <File RelativePath="..\..\src\core\juce_Logger.h"/> | |||
| @@ -368,7 +368,6 @@ | |||
| <Filter Name="core"> | |||
| <File RelativePath="..\..\src\core\juce_FileLogger.cpp"/> | |||
| <File RelativePath="..\..\src\core\juce_FileLogger.h"/> | |||
| <File RelativePath="..\..\src\core\juce_Initialisation.cpp"/> | |||
| <File RelativePath="..\..\src\core\juce_Initialisation.h"/> | |||
| <File RelativePath="..\..\src\core\juce_Logger.cpp"/> | |||
| <File RelativePath="..\..\src\core\juce_Logger.h"/> | |||
| @@ -186,7 +186,6 @@ | |||
| <ClCompile Include="..\..\src\containers\juce_ValueTree.cpp"/> | |||
| <ClCompile Include="..\..\src\containers\juce_Variant.cpp"/> | |||
| <ClCompile Include="..\..\src\core\juce_FileLogger.cpp"/> | |||
| <ClCompile Include="..\..\src\core\juce_Initialisation.cpp"/> | |||
| <ClCompile Include="..\..\src\core\juce_Logger.cpp"/> | |||
| <ClCompile Include="..\..\src\core\juce_PerformanceCounter.cpp"/> | |||
| <ClCompile Include="..\..\src\core\juce_RelativeTime.cpp"/> | |||
| @@ -415,9 +415,6 @@ | |||
| <ClCompile Include="..\..\src\core\juce_FileLogger.cpp"> | |||
| <Filter>Juce\Source\core</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\src\core\juce_Initialisation.cpp"> | |||
| <Filter>Juce\Source\core</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\src\core\juce_Logger.cpp"> | |||
| <Filter>Juce\Source\core</Filter> | |||
| </ClCompile> | |||
| @@ -72,7 +72,6 @@ | |||
| A230949FF8848D5E923F9083 = { isa = PBXBuildFile; fileRef = 5D27EE211D9BFF6A58C4DC42; }; | |||
| 11162E9812CFB0E738A7E2E6 = { isa = PBXBuildFile; fileRef = 4DF9D333038A442870668D31; }; | |||
| C682BEA7DB70FDC7C6BA2D6E = { isa = PBXBuildFile; fileRef = D66C00E06B06EAD3B5257DD6; }; | |||
| 77104E86801B6CAD01F963F4 = { isa = PBXBuildFile; fileRef = 5B789AAC295BA4BB6D5AD4A3; }; | |||
| 6A53DA58B55E2DE7241BF2C8 = { isa = PBXBuildFile; fileRef = 4555F03DBD059EEDECEF9F85; }; | |||
| 0FF71870483AC46D5B7AC5B0 = { isa = PBXBuildFile; fileRef = DF6CAC67C0F2D379BDA03062; }; | |||
| FA01B3EABA192AE041D4FE4D = { isa = PBXBuildFile; fileRef = CFAECB6551F48A1695DEC243; }; | |||
| @@ -536,7 +535,6 @@ | |||
| A81B4FC81A75E21E5B96E506 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Variant.h"; path = "../../src/containers/juce_Variant.h"; sourceTree = "SOURCE_ROOT"; }; | |||
| D66C00E06B06EAD3B5257DD6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_FileLogger.cpp"; path = "../../src/core/juce_FileLogger.cpp"; sourceTree = "SOURCE_ROOT"; }; | |||
| C8441B7B3E4CCD4A257B4BFE = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_FileLogger.h"; path = "../../src/core/juce_FileLogger.h"; sourceTree = "SOURCE_ROOT"; }; | |||
| 5B789AAC295BA4BB6D5AD4A3 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Initialisation.cpp"; path = "../../src/core/juce_Initialisation.cpp"; sourceTree = "SOURCE_ROOT"; }; | |||
| 92ACFFCCCD1C85A0F8C6F80F = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Initialisation.h"; path = "../../src/core/juce_Initialisation.h"; sourceTree = "SOURCE_ROOT"; }; | |||
| 4555F03DBD059EEDECEF9F85 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Logger.cpp"; path = "../../src/core/juce_Logger.cpp"; sourceTree = "SOURCE_ROOT"; }; | |||
| 63F44EC0485FCA050814967E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Logger.h"; path = "../../src/core/juce_Logger.h"; sourceTree = "SOURCE_ROOT"; }; | |||
| @@ -1317,7 +1315,6 @@ | |||
| 1AF37A533ABDD889670F9349 = { isa = PBXGroup; children = ( | |||
| D66C00E06B06EAD3B5257DD6, | |||
| C8441B7B3E4CCD4A257B4BFE, | |||
| 5B789AAC295BA4BB6D5AD4A3, | |||
| 92ACFFCCCD1C85A0F8C6F80F, | |||
| 4555F03DBD059EEDECEF9F85, | |||
| 63F44EC0485FCA050814967E, | |||
| @@ -2139,7 +2136,6 @@ | |||
| A230949FF8848D5E923F9083, | |||
| 11162E9812CFB0E738A7E2E6, | |||
| C682BEA7DB70FDC7C6BA2D6E, | |||
| 77104E86801B6CAD01F963F4, | |||
| 6A53DA58B55E2DE7241BF2C8, | |||
| 0FF71870483AC46D5B7AC5B0, | |||
| FA01B3EABA192AE041D4FE4D, | |||
| @@ -404,8 +404,6 @@ | |||
| file="src/core/juce_FileLogger.cpp"/> | |||
| <FILE id="7nItXGiB" name="juce_FileLogger.h" compile="0" resource="0" | |||
| file="src/core/juce_FileLogger.h"/> | |||
| <FILE id="eux3SL3" name="juce_Initialisation.cpp" compile="1" resource="0" | |||
| file="src/core/juce_Initialisation.cpp"/> | |||
| <FILE id="nsfdNZAs" name="juce_Initialisation.h" compile="0" resource="0" | |||
| file="src/core/juce_Initialisation.h"/> | |||
| <FILE id="43AWfo8b2" name="juce_Logger.cpp" compile="1" resource="0" | |||
| @@ -109,7 +109,6 @@ | |||
| #include "../src/core/juce_SystemStats.cpp" | |||
| #include "../src/core/juce_Result.cpp" | |||
| #include "../src/core/juce_Time.cpp" | |||
| #include "../src/core/juce_Initialisation.cpp" | |||
| #include "../src/containers/juce_AbstractFifo.cpp" | |||
| #include "../src/maths/juce_BigInteger.cpp" | |||
| #include "../src/memory/juce_MemoryBlock.cpp" | |||
| @@ -13,9 +13,9 @@ | |||
| <XCODE_MAC targetFolder="Builds/MacOSX" vstFolder="~/SDKs/vstsdk2.4" rtasFolder="~/SDKs/PT_80_SDK" | |||
| juceFolder="../../../juce" objCExtraSuffix="OeJtJb"/> | |||
| <VS2005 targetFolder="Builds/VisualStudio2005" vstFolder="c:\SDKs\vstsdk2.4" | |||
| rtasFolder="c:\SDKs\PT_80_SDK" juceFolder="../../../juce"/> | |||
| rtasFolder="c:\SDKs\PT_80_SDK" juceFolder="../../../juce" libraryType="1"/> | |||
| <VS2008 targetFolder="Builds/VisualStudio2008" vstFolder="c:\SDKs\vstsdk2.4" | |||
| rtasFolder="c:\SDKs\PT_80_SDK" juceFolder="../../../juce"/> | |||
| rtasFolder="c:\SDKs\PT_80_SDK" juceFolder="../../../juce" libraryType="1"/> | |||
| <LINUX_MAKE targetFolder="Builds/Linux" vstFolder="~/SDKs/vstsdk2.4" juceFolder="../../../juce"/> | |||
| </EXPORTFORMATS> | |||
| <CONFIGURATIONS> | |||
| @@ -2301,151 +2301,6 @@ END_JUCE_NAMESPACE | |||
| /*** End of inlined file: juce_Time.cpp ***/ | |||
| /*** Start of inlined file: juce_Initialisation.cpp ***/ | |||
| BEGIN_JUCE_NAMESPACE | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| #endif | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| static bool juceInitialisedGUI = false; | |||
| JUCE_API void JUCE_CALLTYPE initialiseJuce_GUI() | |||
| { | |||
| if (! juceInitialisedGUI) | |||
| { | |||
| juceInitialisedGUI = true; | |||
| JUCE_AUTORELEASEPOOL | |||
| MessageManager::getInstance(); | |||
| } | |||
| } | |||
| JUCE_API void JUCE_CALLTYPE shutdownJuce_GUI() | |||
| { | |||
| if (juceInitialisedGUI) | |||
| { | |||
| juceInitialisedGUI = false; | |||
| JUCE_AUTORELEASEPOOL | |||
| DeletedAtShutdown::deleteAll(); | |||
| delete MessageManager::getInstance(); | |||
| } | |||
| } | |||
| #endif | |||
| #if JUCE_UNIT_TESTS | |||
| class AtomicTests : public UnitTest | |||
| { | |||
| public: | |||
| AtomicTests() : UnitTest ("Atomics") {} | |||
| void runTest() | |||
| { | |||
| beginTest ("Misc"); | |||
| char a1[7]; | |||
| expect (numElementsInArray(a1) == 7); | |||
| int a2[3]; | |||
| expect (numElementsInArray(a2) == 3); | |||
| expect (ByteOrder::swap ((uint16) 0x1122) == 0x2211); | |||
| expect (ByteOrder::swap ((uint32) 0x11223344) == 0x44332211); | |||
| expect (ByteOrder::swap ((uint64) literal64bit (0x1122334455667788)) == literal64bit (0x8877665544332211)); | |||
| beginTest ("Atomic int"); | |||
| AtomicTester <int>::testInteger (*this); | |||
| beginTest ("Atomic unsigned int"); | |||
| AtomicTester <unsigned int>::testInteger (*this); | |||
| beginTest ("Atomic int32"); | |||
| AtomicTester <int32>::testInteger (*this); | |||
| beginTest ("Atomic uint32"); | |||
| AtomicTester <uint32>::testInteger (*this); | |||
| beginTest ("Atomic long"); | |||
| AtomicTester <long>::testInteger (*this); | |||
| beginTest ("Atomic void*"); | |||
| AtomicTester <void*>::testInteger (*this); | |||
| beginTest ("Atomic int*"); | |||
| AtomicTester <int*>::testInteger (*this); | |||
| beginTest ("Atomic float"); | |||
| AtomicTester <float>::testFloat (*this); | |||
| #if ! JUCE_64BIT_ATOMICS_UNAVAILABLE // 64-bit intrinsics aren't available on some old platforms | |||
| beginTest ("Atomic int64"); | |||
| AtomicTester <int64>::testInteger (*this); | |||
| beginTest ("Atomic uint64"); | |||
| AtomicTester <uint64>::testInteger (*this); | |||
| beginTest ("Atomic double"); | |||
| AtomicTester <double>::testFloat (*this); | |||
| #endif | |||
| } | |||
| template <typename Type> | |||
| class AtomicTester | |||
| { | |||
| public: | |||
| AtomicTester() {} | |||
| static void testInteger (UnitTest& test) | |||
| { | |||
| Atomic<Type> a, b; | |||
| a.set ((Type) 10); | |||
| test.expect (a.value == (Type) 10); | |||
| test.expect (a.get() == (Type) 10); | |||
| a += (Type) 15; | |||
| test.expect (a.get() == (Type) 25); | |||
| a.memoryBarrier(); | |||
| a -= (Type) 5; | |||
| test.expect (a.get() == (Type) 20); | |||
| test.expect (++a == (Type) 21); | |||
| ++a; | |||
| test.expect (--a == (Type) 21); | |||
| test.expect (a.get() == (Type) 21); | |||
| a.memoryBarrier(); | |||
| testFloat (test); | |||
| } | |||
| static void testFloat (UnitTest& test) | |||
| { | |||
| Atomic<Type> a, b; | |||
| a = (Type) 21; | |||
| a.memoryBarrier(); | |||
| /* These are some simple test cases to check the atomics - let me know | |||
| if any of these assertions fail on your system! | |||
| */ | |||
| test.expect (a.get() == (Type) 21); | |||
| test.expect (a.compareAndSetValue ((Type) 100, (Type) 50) == (Type) 21); | |||
| test.expect (a.get() == (Type) 21); | |||
| test.expect (a.compareAndSetValue ((Type) 101, a.get()) == (Type) 21); | |||
| test.expect (a.get() == (Type) 101); | |||
| test.expect (! a.compareAndSetBool ((Type) 300, (Type) 200)); | |||
| test.expect (a.get() == (Type) 101); | |||
| test.expect (a.compareAndSetBool ((Type) 200, a.get())); | |||
| test.expect (a.get() == (Type) 200); | |||
| test.expect (a.exchange ((Type) 300) == (Type) 200); | |||
| test.expect (a.get() == (Type) 300); | |||
| b = a; | |||
| test.expect (b.get() == a.get()); | |||
| } | |||
| }; | |||
| }; | |||
| static AtomicTests atomicUnitTests; | |||
| #endif | |||
| END_JUCE_NAMESPACE | |||
| /*** End of inlined file: juce_Initialisation.cpp ***/ | |||
| /*** Start of inlined file: juce_AbstractFifo.cpp ***/ | |||
| BEGIN_JUCE_NAMESPACE | |||
| @@ -17528,6 +17383,110 @@ void SpinLock::enter() const noexcept | |||
| } | |||
| } | |||
| #if JUCE_UNIT_TESTS | |||
| class AtomicTests : public UnitTest | |||
| { | |||
| public: | |||
| AtomicTests() : UnitTest ("Atomics") {} | |||
| void runTest() | |||
| { | |||
| beginTest ("Misc"); | |||
| char a1[7]; | |||
| expect (numElementsInArray(a1) == 7); | |||
| int a2[3]; | |||
| expect (numElementsInArray(a2) == 3); | |||
| expect (ByteOrder::swap ((uint16) 0x1122) == 0x2211); | |||
| expect (ByteOrder::swap ((uint32) 0x11223344) == 0x44332211); | |||
| expect (ByteOrder::swap ((uint64) literal64bit (0x1122334455667788)) == literal64bit (0x8877665544332211)); | |||
| beginTest ("Atomic int"); | |||
| AtomicTester <int>::testInteger (*this); | |||
| beginTest ("Atomic unsigned int"); | |||
| AtomicTester <unsigned int>::testInteger (*this); | |||
| beginTest ("Atomic int32"); | |||
| AtomicTester <int32>::testInteger (*this); | |||
| beginTest ("Atomic uint32"); | |||
| AtomicTester <uint32>::testInteger (*this); | |||
| beginTest ("Atomic long"); | |||
| AtomicTester <long>::testInteger (*this); | |||
| beginTest ("Atomic void*"); | |||
| AtomicTester <void*>::testInteger (*this); | |||
| beginTest ("Atomic int*"); | |||
| AtomicTester <int*>::testInteger (*this); | |||
| beginTest ("Atomic float"); | |||
| AtomicTester <float>::testFloat (*this); | |||
| #if ! JUCE_64BIT_ATOMICS_UNAVAILABLE // 64-bit intrinsics aren't available on some old platforms | |||
| beginTest ("Atomic int64"); | |||
| AtomicTester <int64>::testInteger (*this); | |||
| beginTest ("Atomic uint64"); | |||
| AtomicTester <uint64>::testInteger (*this); | |||
| beginTest ("Atomic double"); | |||
| AtomicTester <double>::testFloat (*this); | |||
| #endif | |||
| } | |||
| template <typename Type> | |||
| class AtomicTester | |||
| { | |||
| public: | |||
| AtomicTester() {} | |||
| static void testInteger (UnitTest& test) | |||
| { | |||
| Atomic<Type> a, b; | |||
| a.set ((Type) 10); | |||
| test.expect (a.value == (Type) 10); | |||
| test.expect (a.get() == (Type) 10); | |||
| a += (Type) 15; | |||
| test.expect (a.get() == (Type) 25); | |||
| a.memoryBarrier(); | |||
| a -= (Type) 5; | |||
| test.expect (a.get() == (Type) 20); | |||
| test.expect (++a == (Type) 21); | |||
| ++a; | |||
| test.expect (--a == (Type) 21); | |||
| test.expect (a.get() == (Type) 21); | |||
| a.memoryBarrier(); | |||
| testFloat (test); | |||
| } | |||
| static void testFloat (UnitTest& test) | |||
| { | |||
| Atomic<Type> a, b; | |||
| a = (Type) 21; | |||
| a.memoryBarrier(); | |||
| /* These are some simple test cases to check the atomics - let me know | |||
| if any of these assertions fail on your system! | |||
| */ | |||
| test.expect (a.get() == (Type) 21); | |||
| test.expect (a.compareAndSetValue ((Type) 100, (Type) 50) == (Type) 21); | |||
| test.expect (a.get() == (Type) 21); | |||
| test.expect (a.compareAndSetValue ((Type) 101, a.get()) == (Type) 21); | |||
| test.expect (a.get() == (Type) 101); | |||
| test.expect (! a.compareAndSetBool ((Type) 300, (Type) 200)); | |||
| test.expect (a.get() == (Type) 101); | |||
| test.expect (a.compareAndSetBool ((Type) 200, a.get())); | |||
| test.expect (a.get() == (Type) 200); | |||
| test.expect (a.exchange ((Type) 300) == (Type) 200); | |||
| test.expect (a.get() == (Type) 300); | |||
| b = a; | |||
| test.expect (b.get() == a.get()); | |||
| } | |||
| }; | |||
| }; | |||
| static AtomicTests atomicUnitTests; | |||
| #endif | |||
| END_JUCE_NAMESPACE | |||
| /*** End of inlined file: juce_Thread.cpp ***/ | |||
| @@ -40581,7 +40540,7 @@ MessageManager::~MessageManager() noexcept | |||
| instance = nullptr; // do this last in case this instance is still needed by doPlatformSpecificShutdown() | |||
| } | |||
| MessageManager* MessageManager::getInstance() noexcept | |||
| MessageManager* MessageManager::getInstance() | |||
| { | |||
| if (instance == nullptr) | |||
| { | |||
| @@ -40592,6 +40551,11 @@ MessageManager* MessageManager::getInstance() noexcept | |||
| return instance; | |||
| } | |||
| void MessageManager::deleteInstance() | |||
| { | |||
| deleteAndZero (instance); | |||
| } | |||
| void MessageManager::postMessageToQueue (Message* const message) | |||
| { | |||
| if (quitMessagePosted || ! postMessageToSystemQueue (message)) | |||
| @@ -40825,6 +40789,19 @@ MessageManagerLock::~MessageManagerLock() noexcept | |||
| } | |||
| } | |||
| JUCE_API void JUCE_CALLTYPE initialiseJuce_GUI() | |||
| { | |||
| JUCE_AUTORELEASEPOOL | |||
| MessageManager::getInstance(); | |||
| } | |||
| JUCE_API void JUCE_CALLTYPE shutdownJuce_GUI() | |||
| { | |||
| JUCE_AUTORELEASEPOOL | |||
| DeletedAtShutdown::deleteAll(); | |||
| MessageManager::deleteInstance(); | |||
| } | |||
| END_JUCE_NAMESPACE | |||
| /*** End of inlined file: juce_MessageManager.cpp ***/ | |||
| @@ -244468,8 +244445,6 @@ END_JUCE_NAMESPACE | |||
| #ifndef __JUCE_MIDIDATACONCATENATOR_JUCEHEADER__ | |||
| #define __JUCE_MIDIDATACONCATENATOR_JUCEHEADER__ | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| /** | |||
| Helper class that takes chunks of incoming midi bytes, packages them into | |||
| messages, and dispatches them to a midi callback. | |||
| @@ -244582,8 +244557,6 @@ private: | |||
| JUCE_DECLARE_NON_COPYABLE (MidiDataConcatenator); | |||
| }; | |||
| #endif | |||
| #endif // __JUCE_MIDIDATACONCATENATOR_JUCEHEADER__ | |||
| /*** End of inlined file: juce_MidiDataConcatenator.h ***/ | |||
| @@ -244963,9 +244936,7 @@ String SystemStats::getComputerName() | |||
| // compiled on its own). | |||
| #if JUCE_INCLUDED_FILE | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| extern HWND juce_messageWindowHandle; | |||
| #endif | |||
| HWND juce_messageWindowHandle = 0; // (this is used by other parts of the codebase) | |||
| #if ! JUCE_USE_INTRINSICS | |||
| // In newer compilers, the inline versions of these are used (in juce_Atomic.h), but in | |||
| @@ -245050,10 +245021,9 @@ void JUCE_API juce_threadEntryPoint (void*); | |||
| static unsigned int __stdcall threadEntryProc (void* userData) | |||
| { | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| AttachThreadInput (GetWindowThreadProcessId (juce_messageWindowHandle, 0), | |||
| GetCurrentThreadId(), TRUE); | |||
| #endif | |||
| if (juce_messageWindowHandle != 0) | |||
| AttachThreadInput (GetWindowThreadProcessId (juce_messageWindowHandle, 0), | |||
| GetCurrentThreadId(), TRUE); | |||
| juce_threadEntryPoint (userData); | |||
| @@ -246734,7 +246704,7 @@ bool Process::openEmailWithAttachments (const String& targetEmailAddress, | |||
| // compiled on its own). | |||
| #if JUCE_INCLUDED_FILE | |||
| namespace | |||
| namespace RegistryHelpers | |||
| { | |||
| HKEY findKeyForPath (String name, const bool createForWriting, String& valueName) | |||
| { | |||
| @@ -246775,7 +246745,7 @@ namespace | |||
| String WindowsRegistry::getValue (const String& regValuePath, const String& defaultValue) | |||
| { | |||
| String valueName, result (defaultValue); | |||
| HKEY k = findKeyForPath (regValuePath, false, valueName); | |||
| HKEY k = RegistryHelpers::findKeyForPath (regValuePath, false, valueName); | |||
| if (k != 0) | |||
| { | |||
| @@ -246800,7 +246770,7 @@ String WindowsRegistry::getValue (const String& regValuePath, const String& defa | |||
| void WindowsRegistry::setValue (const String& regValuePath, const String& value) | |||
| { | |||
| String valueName; | |||
| HKEY k = findKeyForPath (regValuePath, true, valueName); | |||
| HKEY k = RegistryHelpers::findKeyForPath (regValuePath, true, valueName); | |||
| if (k != 0) | |||
| { | |||
| @@ -246816,7 +246786,7 @@ bool WindowsRegistry::valueExists (const String& regValuePath) | |||
| { | |||
| bool exists = false; | |||
| String valueName; | |||
| HKEY k = findKeyForPath (regValuePath, false, valueName); | |||
| HKEY k = RegistryHelpers::findKeyForPath (regValuePath, false, valueName); | |||
| if (k != 0) | |||
| { | |||
| @@ -246836,7 +246806,7 @@ bool WindowsRegistry::valueExists (const String& regValuePath) | |||
| void WindowsRegistry::deleteValue (const String& regValuePath) | |||
| { | |||
| String valueName; | |||
| HKEY k = findKeyForPath (regValuePath, true, valueName); | |||
| HKEY k = RegistryHelpers::findKeyForPath (regValuePath, true, valueName); | |||
| if (k != 0) | |||
| { | |||
| @@ -246848,7 +246818,7 @@ void WindowsRegistry::deleteValue (const String& regValuePath) | |||
| void WindowsRegistry::deleteKey (const String& regKeyPath) | |||
| { | |||
| String valueName; | |||
| HKEY k = findKeyForPath (regKeyPath, true, valueName); | |||
| HKEY k = RegistryHelpers::findKeyForPath (regKeyPath, true, valueName); | |||
| if (k != 0) | |||
| { | |||
| @@ -246926,8 +246896,6 @@ private: | |||
| LPCTSTR getClassNameFromAtom() noexcept { return (LPCTSTR) MAKELONG (atom, 0); } | |||
| }; | |||
| HWND juce_messageWindowHandle = 0; // (this is referred to by other parts of the codebase) | |||
| class JuceWindowIdentifier | |||
| { | |||
| public: | |||
| @@ -252099,9 +252067,9 @@ bool juce_IsRunningInWine() | |||
| String JUCE_CALLTYPE Process::getCurrentCommandLineParams() | |||
| { | |||
| return String (CharacterFunctions::findEndOfToken (CharPointer_UTF16 (GetCommandLineW()), | |||
| CharPointer_UTF16 (L" "), | |||
| CharPointer_UTF16 (L"\""))).trimStart(); | |||
| return CharacterFunctions::findEndOfToken (CharPointer_UTF16 (GetCommandLineW()), | |||
| CharPointer_UTF16 (L" "), | |||
| CharPointer_UTF16 (L"\"")).findEndOfWhitespace(); | |||
| } | |||
| static void* currentModuleHandle = nullptr; | |||
| @@ -263934,30 +263902,22 @@ bool Time::setSystemTimeToThisTime() const | |||
| live in juce_posix_SharedCode.h! | |||
| */ | |||
| // sets the process to 0=low priority, 1=normal, 2=high, 3=realtime | |||
| void Process::setPriority (ProcessPriority prior) | |||
| void Process::setPriority (const ProcessPriority prior) | |||
| { | |||
| struct sched_param param; | |||
| int policy, maxp, minp; | |||
| const int p = (int) prior; | |||
| if (p <= 1) | |||
| policy = SCHED_OTHER; | |||
| else | |||
| policy = SCHED_RR; | |||
| const int policy = (prior <= NormalPriority) ? SCHED_OTHER : SCHED_RR; | |||
| const int minp = sched_get_priority_min (policy); | |||
| const int maxp = sched_get_priority_max (policy); | |||
| minp = sched_get_priority_min (policy); | |||
| maxp = sched_get_priority_max (policy); | |||
| struct sched_param param; | |||
| if (p < 2) | |||
| param.sched_priority = 0; | |||
| else if (p == 2 ) | |||
| // Set to middle of lower realtime priority range | |||
| param.sched_priority = minp + (maxp - minp) / 4; | |||
| else | |||
| // Set to middle of higher realtime priority range | |||
| param.sched_priority = minp + (3 * (maxp - minp) / 4); | |||
| switch (prior) | |||
| { | |||
| case LowPriority: | |||
| case NormalPriority: param.sched_priority = 0; break; | |||
| case HighPriority: param.sched_priority = minp + (maxp - minp) / 4; break; | |||
| case RealtimePriority: param.sched_priority = minp + (3 * (maxp - minp) / 4); break; | |||
| default: jassertfalse; break; | |||
| } | |||
| pthread_setschedparam (pthread_self(), policy, ¶m); | |||
| } | |||
| @@ -263992,8 +263952,7 @@ JUCE_API bool JUCE_CALLTYPE Process::isRunningUnderDebugger() | |||
| void Process::raisePrivilege() | |||
| { | |||
| // If running suid root, change effective user | |||
| // to root | |||
| // If running suid root, change effective user to root | |||
| if (geteuid() != 0 && getuid() == 0) | |||
| { | |||
| setreuid (geteuid(), getuid()); | |||
| @@ -264003,8 +263962,7 @@ void Process::raisePrivilege() | |||
| void Process::lowerPrivilege() | |||
| { | |||
| // If runing suid root, change effective user | |||
| // back to real user | |||
| // If runing suid root, change effective user back to real user | |||
| if (geteuid() == 0 && getuid() != 0) | |||
| { | |||
| setreuid (geteuid(), getuid()); | |||
| @@ -270837,7 +270795,10 @@ BEGIN_JUCE_NAMESPACE | |||
| #undef Point | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| #define JUCE_INCLUDED_FILE 1 | |||
| // Now include the actual code files.. | |||
| /*** Start of inlined file: juce_osx_ObjCHelpers.h ***/ | |||
| #ifndef __JUCE_OSX_OBJCHELPERS_JUCEHEADER__ | |||
| @@ -270893,89 +270854,6 @@ ScopedAutoReleasePool::~ScopedAutoReleasePool() | |||
| /*** End of inlined file: juce_osx_ObjCHelpers.h ***/ | |||
| /*** Start of inlined file: juce_osx_MessageQueue.h ***/ | |||
| #ifndef __JUCE_OSX_MESSAGEQUEUE_JUCEHEADER__ | |||
| #define __JUCE_OSX_MESSAGEQUEUE_JUCEHEADER__ | |||
| /* An internal message pump class used in OSX and iOS. */ | |||
| class MessageQueue | |||
| { | |||
| public: | |||
| MessageQueue() | |||
| { | |||
| #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 && ! JUCE_IOS | |||
| runLoop = CFRunLoopGetMain(); | |||
| #else | |||
| runLoop = CFRunLoopGetCurrent(); | |||
| #endif | |||
| CFRunLoopSourceContext sourceContext = { 0 }; | |||
| sourceContext.info = this; | |||
| sourceContext.perform = runLoopSourceCallback; | |||
| runLoopSource = CFRunLoopSourceCreate (kCFAllocatorDefault, 1, &sourceContext); | |||
| CFRunLoopAddSource (runLoop, runLoopSource, kCFRunLoopCommonModes); | |||
| } | |||
| ~MessageQueue() | |||
| { | |||
| CFRunLoopRemoveSource (runLoop, runLoopSource, kCFRunLoopCommonModes); | |||
| CFRunLoopSourceInvalidate (runLoopSource); | |||
| CFRelease (runLoopSource); | |||
| } | |||
| void post (Message* const message) | |||
| { | |||
| messages.add (message); | |||
| CFRunLoopSourceSignal (runLoopSource); | |||
| CFRunLoopWakeUp (runLoop); | |||
| } | |||
| private: | |||
| ReferenceCountedArray <Message, CriticalSection> messages; | |||
| CriticalSection lock; | |||
| CFRunLoopRef runLoop; | |||
| CFRunLoopSourceRef runLoopSource; | |||
| bool deliverNextMessage() | |||
| { | |||
| const Message::Ptr nextMessage (messages.removeAndReturn (0)); | |||
| if (nextMessage == nullptr) | |||
| return false; | |||
| JUCE_AUTORELEASEPOOL | |||
| MessageManager::getInstance()->deliverMessage (nextMessage); | |||
| return true; | |||
| } | |||
| void runLoopCallback() | |||
| { | |||
| for (int i = 4; --i >= 0;) | |||
| if (! deliverNextMessage()) | |||
| return; | |||
| CFRunLoopSourceSignal (runLoopSource); | |||
| CFRunLoopWakeUp (runLoop); | |||
| } | |||
| static void runLoopSourceCallback (void* info) | |||
| { | |||
| static_cast <MessageQueue*> (info)->runLoopCallback(); | |||
| } | |||
| }; | |||
| #endif // __JUCE_OSX_MESSAGEQUEUE_JUCEHEADER__ | |||
| /*** End of inlined file: juce_osx_MessageQueue.h ***/ | |||
| #endif | |||
| #define JUCE_INCLUDED_FILE 1 | |||
| // Now include the actual code files.. | |||
| /*** Start of inlined file: juce_mac_ObjCSuffix.h ***/ | |||
| /** This suffix is used for naming all Obj-C classes that are used inside juce. | |||
| @@ -273350,6 +273228,83 @@ JUCE_API bool JUCE_CALLTYPE Process::isRunningUnderDebugger() | |||
| /*** End of inlined file: juce_mac_Debugging.mm ***/ | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| /*** Start of inlined file: juce_osx_MessageQueue.h ***/ | |||
| #ifndef __JUCE_OSX_MESSAGEQUEUE_JUCEHEADER__ | |||
| #define __JUCE_OSX_MESSAGEQUEUE_JUCEHEADER__ | |||
| /* An internal message pump class used in OSX and iOS. */ | |||
| class MessageQueue | |||
| { | |||
| public: | |||
| MessageQueue() | |||
| { | |||
| #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 && ! JUCE_IOS | |||
| runLoop = CFRunLoopGetMain(); | |||
| #else | |||
| runLoop = CFRunLoopGetCurrent(); | |||
| #endif | |||
| CFRunLoopSourceContext sourceContext = { 0 }; | |||
| sourceContext.info = this; | |||
| sourceContext.perform = runLoopSourceCallback; | |||
| runLoopSource = CFRunLoopSourceCreate (kCFAllocatorDefault, 1, &sourceContext); | |||
| CFRunLoopAddSource (runLoop, runLoopSource, kCFRunLoopCommonModes); | |||
| } | |||
| ~MessageQueue() | |||
| { | |||
| CFRunLoopRemoveSource (runLoop, runLoopSource, kCFRunLoopCommonModes); | |||
| CFRunLoopSourceInvalidate (runLoopSource); | |||
| CFRelease (runLoopSource); | |||
| } | |||
| void post (Message* const message) | |||
| { | |||
| messages.add (message); | |||
| CFRunLoopSourceSignal (runLoopSource); | |||
| CFRunLoopWakeUp (runLoop); | |||
| } | |||
| private: | |||
| ReferenceCountedArray <Message, CriticalSection> messages; | |||
| CriticalSection lock; | |||
| CFRunLoopRef runLoop; | |||
| CFRunLoopSourceRef runLoopSource; | |||
| bool deliverNextMessage() | |||
| { | |||
| const Message::Ptr nextMessage (messages.removeAndReturn (0)); | |||
| if (nextMessage == nullptr) | |||
| return false; | |||
| JUCE_AUTORELEASEPOOL | |||
| MessageManager::getInstance()->deliverMessage (nextMessage); | |||
| return true; | |||
| } | |||
| void runLoopCallback() | |||
| { | |||
| for (int i = 4; --i >= 0;) | |||
| if (! deliverNextMessage()) | |||
| return; | |||
| CFRunLoopSourceSignal (runLoopSource); | |||
| CFRunLoopWakeUp (runLoop); | |||
| } | |||
| static void runLoopSourceCallback (void* info) | |||
| { | |||
| static_cast <MessageQueue*> (info)->runLoopCallback(); | |||
| } | |||
| }; | |||
| #endif // __JUCE_OSX_MESSAGEQUEUE_JUCEHEADER__ | |||
| /*** End of inlined file: juce_osx_MessageQueue.h ***/ | |||
| #if JUCE_IOS | |||
| /*** Start of inlined file: juce_mac_Fonts.mm ***/ | |||
| @@ -73,7 +73,7 @@ namespace JuceDummyNamespace {} | |||
| */ | |||
| #define JUCE_MAJOR_VERSION 1 | |||
| #define JUCE_MINOR_VERSION 54 | |||
| #define JUCE_BUILDNUMBER 9 | |||
| #define JUCE_BUILDNUMBER 10 | |||
| /** Current Juce version number. | |||
| @@ -12175,7 +12175,7 @@ private: | |||
| } | |||
| @endcode | |||
| */ | |||
| class Result | |||
| class JUCE_API Result | |||
| { | |||
| public: | |||
| @@ -22176,7 +22176,7 @@ private: | |||
| Since the DLL is freed when this object is deleted, it's handy for managing | |||
| library lifetimes using RAII. | |||
| */ | |||
| class DynamicLibrary | |||
| class JUCE_API DynamicLibrary | |||
| { | |||
| public: | |||
| /** Creates an unopened DynamicLibrary object. | |||
| @@ -48225,7 +48225,12 @@ class JUCE_API MessageManager | |||
| public: | |||
| /** Returns the global instance of the MessageManager. */ | |||
| static MessageManager* getInstance() noexcept; | |||
| static MessageManager* getInstance(); | |||
| /** Deletes the global MessageManager instance. | |||
| Does nothing if no instance had been created. | |||
| */ | |||
| static void deleteInstance(); | |||
| /** Runs the event dispatch loop until a stop message is posted. | |||
| @@ -27,42 +27,6 @@ | |||
| BEGIN_JUCE_NAMESPACE | |||
| #include "../utilities/juce_DeletedAtShutdown.h" | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| #include "../events/juce_MessageManager.h" | |||
| #endif | |||
| //============================================================================== | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| static bool juceInitialisedGUI = false; | |||
| JUCE_API void JUCE_CALLTYPE initialiseJuce_GUI() | |||
| { | |||
| if (! juceInitialisedGUI) | |||
| { | |||
| juceInitialisedGUI = true; | |||
| JUCE_AUTORELEASEPOOL | |||
| MessageManager::getInstance(); | |||
| } | |||
| } | |||
| JUCE_API void JUCE_CALLTYPE shutdownJuce_GUI() | |||
| { | |||
| if (juceInitialisedGUI) | |||
| { | |||
| juceInitialisedGUI = false; | |||
| JUCE_AUTORELEASEPOOL | |||
| DeletedAtShutdown::deleteAll(); | |||
| delete MessageManager::getInstance(); | |||
| } | |||
| } | |||
| #endif | |||
| //============================================================================== | |||
| #if JUCE_UNIT_TESTS | |||
| @@ -57,7 +57,7 @@ | |||
| } | |||
| @endcode | |||
| */ | |||
| class Result | |||
| class JUCE_API Result | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| @@ -33,7 +33,7 @@ | |||
| */ | |||
| #define JUCE_MAJOR_VERSION 1 | |||
| #define JUCE_MINOR_VERSION 54 | |||
| #define JUCE_BUILDNUMBER 9 | |||
| #define JUCE_BUILDNUMBER 10 | |||
| /** Current Juce version number. | |||
| @@ -63,7 +63,7 @@ MessageManager::~MessageManager() noexcept | |||
| instance = nullptr; // do this last in case this instance is still needed by doPlatformSpecificShutdown() | |||
| } | |||
| MessageManager* MessageManager::getInstance() noexcept | |||
| MessageManager* MessageManager::getInstance() | |||
| { | |||
| if (instance == nullptr) | |||
| { | |||
| @@ -74,6 +74,11 @@ MessageManager* MessageManager::getInstance() noexcept | |||
| return instance; | |||
| } | |||
| void MessageManager::deleteInstance() | |||
| { | |||
| deleteAndZero (instance); | |||
| } | |||
| void MessageManager::postMessageToQueue (Message* const message) | |||
| { | |||
| if (quitMessagePosted || ! postMessageToSystemQueue (message)) | |||
| @@ -315,5 +320,18 @@ MessageManagerLock::~MessageManagerLock() noexcept | |||
| } | |||
| } | |||
| //============================================================================== | |||
| JUCE_API void JUCE_CALLTYPE initialiseJuce_GUI() | |||
| { | |||
| JUCE_AUTORELEASEPOOL | |||
| MessageManager::getInstance(); | |||
| } | |||
| JUCE_API void JUCE_CALLTYPE shutdownJuce_GUI() | |||
| { | |||
| JUCE_AUTORELEASEPOOL | |||
| DeletedAtShutdown::deleteAll(); | |||
| MessageManager::deleteInstance(); | |||
| } | |||
| END_JUCE_NAMESPACE | |||
| @@ -53,7 +53,12 @@ class JUCE_API MessageManager | |||
| public: | |||
| //============================================================================== | |||
| /** Returns the global instance of the MessageManager. */ | |||
| static MessageManager* getInstance() noexcept; | |||
| static MessageManager* getInstance(); | |||
| /** Deletes the global MessageManager instance. | |||
| Does nothing if no instance had been created. | |||
| */ | |||
| static void deleteInstance(); | |||
| //============================================================================== | |||
| /** Runs the event dispatch loop until a stop message is posted. | |||
| @@ -89,7 +89,6 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../../audio/midi/juce_MidiOutput.h" | |||
| #include "../../audio/midi/juce_MidiInput.h" | |||
| #include "../../containers/juce_ScopedValueSetter.h" | |||
| #include "../common/juce_MidiDataConcatenator.h" | |||
| #define USE_ANDROID_CANVAS 0 | |||
| @@ -26,8 +26,6 @@ | |||
| #ifndef __JUCE_MIDIDATACONCATENATOR_JUCEHEADER__ | |||
| #define __JUCE_MIDIDATACONCATENATOR_JUCEHEADER__ | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| //============================================================================== | |||
| /** | |||
| Helper class that takes chunks of incoming midi bytes, packages them into | |||
| @@ -141,6 +139,4 @@ private: | |||
| JUCE_DECLARE_NON_COPYABLE (MidiDataConcatenator); | |||
| }; | |||
| #endif | |||
| #endif // __JUCE_MIDIDATACONCATENATOR_JUCEHEADER__ | |||
| @@ -33,30 +33,22 @@ | |||
| */ | |||
| //============================================================================== | |||
| // sets the process to 0=low priority, 1=normal, 2=high, 3=realtime | |||
| void Process::setPriority (ProcessPriority prior) | |||
| void Process::setPriority (const ProcessPriority prior) | |||
| { | |||
| struct sched_param param; | |||
| int policy, maxp, minp; | |||
| const int p = (int) prior; | |||
| if (p <= 1) | |||
| policy = SCHED_OTHER; | |||
| else | |||
| policy = SCHED_RR; | |||
| const int policy = (prior <= NormalPriority) ? SCHED_OTHER : SCHED_RR; | |||
| const int minp = sched_get_priority_min (policy); | |||
| const int maxp = sched_get_priority_max (policy); | |||
| minp = sched_get_priority_min (policy); | |||
| maxp = sched_get_priority_max (policy); | |||
| struct sched_param param; | |||
| if (p < 2) | |||
| param.sched_priority = 0; | |||
| else if (p == 2 ) | |||
| // Set to middle of lower realtime priority range | |||
| param.sched_priority = minp + (maxp - minp) / 4; | |||
| else | |||
| // Set to middle of higher realtime priority range | |||
| param.sched_priority = minp + (3 * (maxp - minp) / 4); | |||
| switch (prior) | |||
| { | |||
| case LowPriority: | |||
| case NormalPriority: param.sched_priority = 0; break; | |||
| case HighPriority: param.sched_priority = minp + (maxp - minp) / 4; break; | |||
| case RealtimePriority: param.sched_priority = minp + (3 * (maxp - minp) / 4); break; | |||
| default: jassertfalse; break; | |||
| } | |||
| pthread_setschedparam (pthread_self(), policy, ¶m); | |||
| } | |||
| @@ -91,8 +83,7 @@ JUCE_API bool JUCE_CALLTYPE Process::isRunningUnderDebugger() | |||
| void Process::raisePrivilege() | |||
| { | |||
| // If running suid root, change effective user | |||
| // to root | |||
| // If running suid root, change effective user to root | |||
| if (geteuid() != 0 && getuid() == 0) | |||
| { | |||
| setreuid (geteuid(), getuid()); | |||
| @@ -102,8 +93,7 @@ void Process::raisePrivilege() | |||
| void Process::lowerPrivilege() | |||
| { | |||
| // If runing suid root, change effective user | |||
| // back to real user | |||
| // If runing suid root, change effective user back to real user | |||
| if (geteuid() == 0 && getuid() != 0) | |||
| { | |||
| setreuid (geteuid(), getuid()); | |||
| @@ -97,19 +97,14 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../../audio/midi/juce_MidiInput.h" | |||
| #include "../../containers/juce_ScopedValueSetter.h" | |||
| #include "../../events/juce_AppleRemote.h" | |||
| #include "../common/juce_MidiDataConcatenator.h" | |||
| #undef Point | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| #include "juce_osx_ObjCHelpers.h" | |||
| #include "juce_osx_MessageQueue.h" | |||
| #endif | |||
| //============================================================================== | |||
| #define JUCE_INCLUDED_FILE 1 | |||
| // Now include the actual code files.. | |||
| #include "juce_osx_ObjCHelpers.h" | |||
| #include "juce_mac_ObjCSuffix.h" | |||
| #include "juce_mac_Strings.mm" | |||
| #include "juce_mac_SystemStats.mm" | |||
| @@ -121,6 +116,9 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "juce_mac_Debugging.mm" | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| #include "juce_osx_MessageQueue.h" | |||
| #include "../common/juce_MidiDataConcatenator.h" | |||
| #if JUCE_IOS | |||
| #include "juce_mac_Fonts.mm" | |||
| #include "juce_mac_CoreGraphicsContext.mm" | |||
| @@ -70,9 +70,6 @@ private: | |||
| }; | |||
| //============================================================================== | |||
| HWND juce_messageWindowHandle = 0; // (this is referred to by other parts of the codebase) | |||
| //============================================================================== | |||
| class JuceWindowIdentifier | |||
| { | |||
| @@ -38,9 +38,9 @@ bool juce_IsRunningInWine() | |||
| //============================================================================== | |||
| String JUCE_CALLTYPE Process::getCurrentCommandLineParams() | |||
| { | |||
| return String (CharacterFunctions::findEndOfToken (CharPointer_UTF16 (GetCommandLineW()), | |||
| CharPointer_UTF16 (L" "), | |||
| CharPointer_UTF16 (L"\""))).trimStart(); | |||
| return CharacterFunctions::findEndOfToken (CharPointer_UTF16 (GetCommandLineW()), | |||
| CharPointer_UTF16 (L" "), | |||
| CharPointer_UTF16 (L"\"")).findEndOfWhitespace(); | |||
| } | |||
| //============================================================================== | |||
| @@ -94,7 +94,6 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../../audio/midi/juce_MidiInput.h" | |||
| #include "../../containers/juce_ScopedValueSetter.h" | |||
| #include "../../utilities/juce_WindowsRegistry.h" | |||
| #include "../common/juce_MidiDataConcatenator.h" | |||
| //============================================================================== | |||
| #define JUCE_INCLUDED_FILE 1 | |||
| @@ -119,6 +118,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "juce_win32_WebBrowserComponent.cpp" | |||
| #include "juce_win32_OpenGLComponent.cpp" | |||
| #include "juce_win32_AudioCDReader.cpp" | |||
| #include "../common/juce_MidiDataConcatenator.h" | |||
| #include "juce_win32_Midi.cpp" | |||
| #include "juce_win32_ASIO.cpp" | |||
| #include "juce_win32_DirectSound.cpp" | |||
| @@ -29,7 +29,7 @@ | |||
| //============================================================================== | |||
| namespace | |||
| namespace RegistryHelpers | |||
| { | |||
| HKEY findKeyForPath (String name, const bool createForWriting, String& valueName) | |||
| { | |||
| @@ -70,7 +70,7 @@ namespace | |||
| String WindowsRegistry::getValue (const String& regValuePath, const String& defaultValue) | |||
| { | |||
| String valueName, result (defaultValue); | |||
| HKEY k = findKeyForPath (regValuePath, false, valueName); | |||
| HKEY k = RegistryHelpers::findKeyForPath (regValuePath, false, valueName); | |||
| if (k != 0) | |||
| { | |||
| @@ -95,7 +95,7 @@ String WindowsRegistry::getValue (const String& regValuePath, const String& defa | |||
| void WindowsRegistry::setValue (const String& regValuePath, const String& value) | |||
| { | |||
| String valueName; | |||
| HKEY k = findKeyForPath (regValuePath, true, valueName); | |||
| HKEY k = RegistryHelpers::findKeyForPath (regValuePath, true, valueName); | |||
| if (k != 0) | |||
| { | |||
| @@ -111,7 +111,7 @@ bool WindowsRegistry::valueExists (const String& regValuePath) | |||
| { | |||
| bool exists = false; | |||
| String valueName; | |||
| HKEY k = findKeyForPath (regValuePath, false, valueName); | |||
| HKEY k = RegistryHelpers::findKeyForPath (regValuePath, false, valueName); | |||
| if (k != 0) | |||
| { | |||
| @@ -131,7 +131,7 @@ bool WindowsRegistry::valueExists (const String& regValuePath) | |||
| void WindowsRegistry::deleteValue (const String& regValuePath) | |||
| { | |||
| String valueName; | |||
| HKEY k = findKeyForPath (regValuePath, true, valueName); | |||
| HKEY k = RegistryHelpers::findKeyForPath (regValuePath, true, valueName); | |||
| if (k != 0) | |||
| { | |||
| @@ -143,7 +143,7 @@ void WindowsRegistry::deleteValue (const String& regValuePath) | |||
| void WindowsRegistry::deleteKey (const String& regKeyPath) | |||
| { | |||
| String valueName; | |||
| HKEY k = findKeyForPath (regKeyPath, true, valueName); | |||
| HKEY k = RegistryHelpers::findKeyForPath (regKeyPath, true, valueName); | |||
| if (k != 0) | |||
| { | |||
| @@ -27,9 +27,7 @@ | |||
| // compiled on its own). | |||
| #if JUCE_INCLUDED_FILE | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| extern HWND juce_messageWindowHandle; | |||
| #endif | |||
| HWND juce_messageWindowHandle = 0; // (this is used by other parts of the codebase) | |||
| //============================================================================== | |||
| #if ! JUCE_USE_INTRINSICS | |||
| @@ -118,10 +116,9 @@ void JUCE_API juce_threadEntryPoint (void*); | |||
| static unsigned int __stdcall threadEntryProc (void* userData) | |||
| { | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| AttachThreadInput (GetWindowThreadProcessId (juce_messageWindowHandle, 0), | |||
| GetCurrentThreadId(), TRUE); | |||
| #endif | |||
| if (juce_messageWindowHandle != 0) | |||
| AttachThreadInput (GetWindowThreadProcessId (juce_messageWindowHandle, 0), | |||
| GetCurrentThreadId(), TRUE); | |||
| juce_threadEntryPoint (userData); | |||
| @@ -33,7 +33,7 @@ | |||
| Since the DLL is freed when this object is deleted, it's handy for managing | |||
| library lifetimes using RAII. | |||
| */ | |||
| class DynamicLibrary | |||
| class JUCE_API DynamicLibrary | |||
| { | |||
| public: | |||
| /** Creates an unopened DynamicLibrary object. | |||
| @@ -338,5 +338,111 @@ void SpinLock::enter() const noexcept | |||
| } | |||
| } | |||
| //============================================================================== | |||
| #if JUCE_UNIT_TESTS | |||
| #include "../utilities/juce_UnitTest.h" | |||
| class AtomicTests : public UnitTest | |||
| { | |||
| public: | |||
| AtomicTests() : UnitTest ("Atomics") {} | |||
| void runTest() | |||
| { | |||
| beginTest ("Misc"); | |||
| char a1[7]; | |||
| expect (numElementsInArray(a1) == 7); | |||
| int a2[3]; | |||
| expect (numElementsInArray(a2) == 3); | |||
| expect (ByteOrder::swap ((uint16) 0x1122) == 0x2211); | |||
| expect (ByteOrder::swap ((uint32) 0x11223344) == 0x44332211); | |||
| expect (ByteOrder::swap ((uint64) literal64bit (0x1122334455667788)) == literal64bit (0x8877665544332211)); | |||
| beginTest ("Atomic int"); | |||
| AtomicTester <int>::testInteger (*this); | |||
| beginTest ("Atomic unsigned int"); | |||
| AtomicTester <unsigned int>::testInteger (*this); | |||
| beginTest ("Atomic int32"); | |||
| AtomicTester <int32>::testInteger (*this); | |||
| beginTest ("Atomic uint32"); | |||
| AtomicTester <uint32>::testInteger (*this); | |||
| beginTest ("Atomic long"); | |||
| AtomicTester <long>::testInteger (*this); | |||
| beginTest ("Atomic void*"); | |||
| AtomicTester <void*>::testInteger (*this); | |||
| beginTest ("Atomic int*"); | |||
| AtomicTester <int*>::testInteger (*this); | |||
| beginTest ("Atomic float"); | |||
| AtomicTester <float>::testFloat (*this); | |||
| #if ! JUCE_64BIT_ATOMICS_UNAVAILABLE // 64-bit intrinsics aren't available on some old platforms | |||
| beginTest ("Atomic int64"); | |||
| AtomicTester <int64>::testInteger (*this); | |||
| beginTest ("Atomic uint64"); | |||
| AtomicTester <uint64>::testInteger (*this); | |||
| beginTest ("Atomic double"); | |||
| AtomicTester <double>::testFloat (*this); | |||
| #endif | |||
| } | |||
| template <typename Type> | |||
| class AtomicTester | |||
| { | |||
| public: | |||
| AtomicTester() {} | |||
| static void testInteger (UnitTest& test) | |||
| { | |||
| Atomic<Type> a, b; | |||
| a.set ((Type) 10); | |||
| test.expect (a.value == (Type) 10); | |||
| test.expect (a.get() == (Type) 10); | |||
| a += (Type) 15; | |||
| test.expect (a.get() == (Type) 25); | |||
| a.memoryBarrier(); | |||
| a -= (Type) 5; | |||
| test.expect (a.get() == (Type) 20); | |||
| test.expect (++a == (Type) 21); | |||
| ++a; | |||
| test.expect (--a == (Type) 21); | |||
| test.expect (a.get() == (Type) 21); | |||
| a.memoryBarrier(); | |||
| testFloat (test); | |||
| } | |||
| static void testFloat (UnitTest& test) | |||
| { | |||
| Atomic<Type> a, b; | |||
| a = (Type) 21; | |||
| a.memoryBarrier(); | |||
| /* These are some simple test cases to check the atomics - let me know | |||
| if any of these assertions fail on your system! | |||
| */ | |||
| test.expect (a.get() == (Type) 21); | |||
| test.expect (a.compareAndSetValue ((Type) 100, (Type) 50) == (Type) 21); | |||
| test.expect (a.get() == (Type) 21); | |||
| test.expect (a.compareAndSetValue ((Type) 101, a.get()) == (Type) 21); | |||
| test.expect (a.get() == (Type) 101); | |||
| test.expect (! a.compareAndSetBool ((Type) 300, (Type) 200)); | |||
| test.expect (a.get() == (Type) 101); | |||
| test.expect (a.compareAndSetBool ((Type) 200, a.get())); | |||
| test.expect (a.get() == (Type) 200); | |||
| test.expect (a.exchange ((Type) 300) == (Type) 200); | |||
| test.expect (a.get() == (Type) 300); | |||
| b = a; | |||
| test.expect (b.get() == a.get()); | |||
| } | |||
| }; | |||
| }; | |||
| static AtomicTests atomicUnitTests; | |||
| #endif | |||
| END_JUCE_NAMESPACE | |||