This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
Go to the source code of this file.
Typedefs | |
typedef std::mutex | ofMutex |
A typedef for a cross-platform mutex. | |
typedef std::unique_lock< std::mutex > | ofScopedLock |
A typedef for a cross-platform scoped mutex. | |
template<typename T > | |
using | ofPtr = std::shared_ptr< T > |
Typedef Documentation
◆ ofMutex
typedef std::mutex ofMutex |
A typedef for a cross-platform mutex.
- Deprecated:
- Please use std::mutex instead of ofMutex. See also the note below.
A mutex is used to lock data when it is accessible from multiple threads. Locking data with a mutex prevents data-races, deadlocks and other problems associated with concurrent access to data.
The mutex can be locked with a call to ofMutex::lock(). All calls to ofMutex::lock() must be paired with a call to ofMutex::unlock().
- Note
- Currently ofMutex is a typedef for std::mutex. This is done to preserve backwards compatibility. Please use std::mutex for new code.
◆ ofPtr
using ofPtr = std::shared_ptr<T> |
◆ ofScopedLock
typedef std::unique_lock<std::mutex> ofScopedLock |
A typedef for a cross-platform scoped mutex.
- Deprecated:
- Please use std::unique_lock<std::mutex> instead of ofScopedLock. See also the note below.
Normally ofMutex requres explicit calls to ofMutex::lock() and ofMutex::unlock() to lock and release the mutex. Sometimes, despite best efforts, developers forget to unlock a mutex, leaving the data inaccessible. ofScopedLock makes ofMutex easier to use by calling ofMutex::unlock when the scoped lock's destructor is called. Since the destructor is called when a variable goes out of scope, we call this a "scoped lock". A "scoped lock" is sometimes known as a "lock guard" as well.
ofScopedLock is used to lock and unlock an existing ofMutex.
- Warning
- Currently ofScopedLock is a typedef for std::unique_lock<std::mutex>. This is done to preserve backwards compatibility. Please use std::unique_lock<std::mutex> for new code.