Shaka Packager SDK
|
Declaration of class which implements a thread-safe circular buffer. More...
#include <io_cache.h>
Public Member Functions | |
IoCache (uint64_t cache_size) | |
uint64_t | Read (void *buffer, uint64_t size) |
uint64_t | Write (const void *buffer, uint64_t size) |
void | Clear () |
Empties the cache. | |
void | Close () |
bool | closed () |
void | Reopen () |
Reopens the cache. Any data still in the cache will be lost. | |
uint64_t | BytesCached () |
uint64_t | BytesFree () |
void | WaitUntilEmptyOrClosed () |
Waits until the cache is empty or has been closed. | |
Declaration of class which implements a thread-safe circular buffer.
Definition at line 20 of file io_cache.h.
uint64_t shaka::IoCache::BytesCached | ( | ) |
Returns the number of bytes in the cache.
Definition at line 119 of file io_cache.cc.
uint64_t shaka::IoCache::BytesFree | ( | ) |
Returns the number of free bytes in the cache.
Definition at line 124 of file io_cache.cc.
void shaka::IoCache::Close | ( | ) |
Close the cache. This will call any blocking calls to unblock, and the cache won't be usable until Reopened.
Definition at line 105 of file io_cache.cc.
|
inline |
Definition at line 50 of file io_cache.h.
uint64_t shaka::IoCache::Read | ( | void * | buffer, |
uint64_t | size | ||
) |
Read data from the cache. This function may block until there is data in the cache.
buffer | is a buffer into which to read the data from the cache. |
size | is the size of buffer. |
Definition at line 33 of file io_cache.cc.
uint64_t shaka::IoCache::Write | ( | const void * | buffer, |
uint64_t | size | ||
) |
Write data to the cache. This function may block until there is enough room in the cache.
buffer | is a buffer containing the data to be written to the cache. |
size | is the size of the data to be written to the cache. |
Definition at line 60 of file io_cache.cc.