JUCE
Classes | Typedefs
threads

Classes

class  ChildProcess
 Launches and monitors a child process. More...
 
class  CriticalSection
 A re-entrant mutex. More...
 
class  DummyCriticalSection
 A class that can be used in place of a real CriticalSection object, but which doesn't perform any locking. More...
 
struct  DummyCriticalSection::ScopedLockType
 A dummy scoped-lock type to use with a dummy critical section. More...
 
class  DynamicLibrary
 Handles the opening and closing of DLLs. More...
 
class  HighResolutionTimer
 A high-resolution periodic timer. More...
 
class  InterProcessLock
 Acts as a critical section which processes can use to block each other. More...
 
class  InterProcessLock::ScopedLockType
 Automatically locks and unlocks an InterProcessLock object. More...
 
class  Process
 Represents the current executable's process. More...
 
class  ReadWriteLock
 A critical section that allows multiple simultaneous readers. More...
 
class  GenericScopedLock< LockType >
 Automatically locks and unlocks a mutex object. More...
 
class  GenericScopedUnlock< LockType >
 Automatically unlocks and re-locks a mutex object. More...
 
class  GenericScopedTryLock< LockType >
 Automatically locks and unlocks a mutex object. More...
 
class  ScopedReadLock
 Automatically locks and unlocks a ReadWriteLock object. More...
 
class  ScopedWriteLock
 Automatically locks and unlocks a ReadWriteLock object. More...
 
class  SpinLock
 A simple spin-lock class that can be used as a simple, low-overhead mutex for uncontended situations. More...
 
class  Thread
 Encapsulates a thread. More...
 
class  Thread::Listener
 Used to receive callbacks for thread exit calls. More...
 
class  ThreadLocalValue< Type >
 Provides cross-platform support for thread-local objects. More...
 
class  ThreadPoolJob
 A task that is executed by a ThreadPool object. More...
 
class  ThreadPool
 A set of threads that will run a list of jobs. More...
 
class  ThreadPool::JobSelector
 A callback class used when you need to select which ThreadPoolJob objects are suitable for some kind of operation. More...
 
class  TimeSliceClient
 Used by the TimeSliceThread class. More...
 
class  TimeSliceThread
 A thread that keeps a list of clients, and calls each one in turn, giving them all a chance to run some sort of short task. More...
 
class  WaitableEvent
 Allows threads to wait for events triggered by other threads. More...
 

Typedefs

using ScopedLock = CriticalSection::ScopedLockType
 Automatically locks and unlocks a CriticalSection object. More...
 
using ScopedUnlock = CriticalSection::ScopedUnlockType
 Automatically unlocks and re-locks a CriticalSection object. More...
 
using ScopedTryLock = CriticalSection::ScopedTryLockType
 Automatically tries to lock and unlock a CriticalSection object. More...
 

Detailed Description

Typedef Documentation

◆ ScopedLock

Automatically locks and unlocks a CriticalSection object.

You can use a ScopedLock as a local variable to provide RAII-based locking of a CriticalSection.

e.g.

struct MyObject
{
CriticalSection objectLock;
// assuming that this example function will be called by multiple threads
void foo()
{
const ScopedLock myScopedLock (objectLock);
// objectLock is now locked..
...do some thread-safe work here...
// ..and objectLock gets unlocked here, as myScopedLock goes out of
// scope at the end of the block
}
};
See also
CriticalSection, ScopedUnlock

◆ ScopedUnlock

Automatically unlocks and re-locks a CriticalSection object.

This is the reverse of a ScopedLock object - instead of locking the critical section for the lifetime of this object, it unlocks it.

Make sure you don't try to unlock critical sections that aren't actually locked!

e.g.

struct MyObject
{
CriticalSection objectLock;
void foo()
{
{
const ScopedLock myScopedLock (objectLock);
// objectLock is now locked..
{
ScopedUnlock myUnlocker (objectLock);
// ..and now unlocked..
}
// ..and now locked again..
}
// ..and finally unlocked.
}
};
See also
CriticalSection, ScopedLock

◆ ScopedTryLock

Automatically tries to lock and unlock a CriticalSection object.

Use one of these as a local variable to control access to a CriticalSection.

e.g.

struct MyObject
{
CriticalSection objectLock;
void foo()
{
const ScopedTryLock myScopedTryLock (objectLock);
// Unlike using a ScopedLock, this may fail to actually get the lock, so you
// must call the isLocked() method before making any assumptions..
if (myScopedTryLock.isLocked())
{
...safely do some work...
}
else
{
// If we get here, then our attempt at locking failed because another thread had already locked it..
}
}
};
See also
CriticalSection::tryEnter, ScopedLock, ScopedUnlock, ScopedReadLock