diff options
author | Drew Richardson <drew.richardson@arm.com> | 2012-12-14 12:00:00 -0800 |
---|---|---|
committer | Drew Richardson <drew.richardson@arm.com> | 2014-12-19 15:33:02 -0800 |
commit | a01058e248133bb7c1ba0238ab380e4fac924e97 (patch) | |
tree | 8fc08c126fcb711fc9a2011eb6314c68d429b800 /daemon/Fifo.cpp | |
parent | b04e8aefeed42f23955e88c7aa1611e49bdf5909 (diff) |
gator: Version 5.135.13
Signed-off-by: Drew Richardson <drew.richardson@arm.com>
Diffstat (limited to 'daemon/Fifo.cpp')
-rw-r--r-- | daemon/Fifo.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/daemon/Fifo.cpp b/daemon/Fifo.cpp index 191536f..4a27452 100644 --- a/daemon/Fifo.cpp +++ b/daemon/Fifo.cpp @@ -12,8 +12,6 @@ #include "Fifo.h" #include "Logging.h" -extern void handleException(); - // bufferSize is the amount of data to be filled // singleBufferSize is the maximum size that may be filled during a single write // (bufferSize + singleBufferSize) will be allocated @@ -37,27 +35,29 @@ Fifo::Fifo(int singleBufferSize, int bufferSize) { Fifo::~Fifo() { free(mBuffer); + sem_destroy(&mWaitForSpaceSem); + sem_destroy(&mWaitForDataSem); } -int Fifo::numBytesFilled() { +int Fifo::numBytesFilled() const { return mWrite - mRead + mRaggedEnd; } -char* Fifo::start() { +char* Fifo::start() const { return mBuffer; } -bool Fifo::isEmpty() { +bool Fifo::isEmpty() const { return mRead == mWrite && mRaggedEnd == 0; } -bool Fifo::isFull() { +bool Fifo::isFull() const { return willFill(0); } // Determines if the buffer will fill assuming 'additional' bytes will be added to the buffer // 'full' means there is less than singleBufferSize bytes available contiguously; it does not mean there are zero bytes available -bool Fifo::willFill(int additional) { +bool Fifo::willFill(int additional) const { if (mWrite > mRead) { if (numBytesFilled() + additional < mWrapThreshold) { return false; @@ -98,7 +98,7 @@ char* Fifo::write(int length) { } // This function will stall until data is available -char* Fifo::read(int* length) { +char* Fifo::read(int *const length) { // update the read pointer now that the data has been handled mRead = mReadCommit; |