API
4.3
For C++ developers
|
This class lets you store objects of a single type for reuse by multiple threads, ensuring threadsafe access to each of those objects. More...
Public Member Functions | |
std::unique_ptr< T > | take () |
Request an object for your exclusive use on your thread. More... | |
void | leave (std::unique_ptr< T > entry) |
Add or return an object so that another thread can use it. More... | |
int | size () const |
Obtain the number of entries that can be taken. More... | |
This class lets you store objects of a single type for reuse by multiple threads, ensuring threadsafe access to each of those objects.
|
inline |
Add or return an object so that another thread can use it.
You will need to std::move() the entry, ensuring that you will no longer have access to the entry in your code (the pointer will now be null).
|
inline |
Obtain the number of entries that can be taken.
|
inline |
Request an object for your exclusive use on your thread.
This function blocks the thread until an object is available. Make sure to return (leave()) the object when you're done!