mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-23 01:44:22 +00:00
Added new class: SpinLock, and used it to optimise a few bits of code.
This commit is contained in:
parent
819e8c441a
commit
37877037f4
17 changed files with 331 additions and 205 deletions
|
|
@ -312,7 +312,7 @@ public:
|
|||
|
||||
const pthread_t thisThread = pthread_self();
|
||||
|
||||
ScopedLock sl (addRemoveLock);
|
||||
SpinLock::ScopedLockType sl (addRemoveLock);
|
||||
for (int i = 0; i < maxThreads; ++i)
|
||||
if (threads[i] == thisThread)
|
||||
threads[i] = 0;
|
||||
|
|
@ -335,11 +335,11 @@ private:
|
|||
JavaVM* jvm;
|
||||
pthread_t threads [maxThreads];
|
||||
JNIEnv* envs [maxThreads];
|
||||
CriticalSection addRemoveLock;
|
||||
SpinLock addRemoveLock;
|
||||
|
||||
void addEnv (JNIEnv* env)
|
||||
{
|
||||
ScopedLock sl (addRemoveLock);
|
||||
SpinLock::ScopedLockType sl (addRemoveLock);
|
||||
|
||||
if (get() == 0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue