summaryrefslogtreecommitdiffstats
path: root/libs/rs/rsLocklessFifo.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/rs/rsLocklessFifo.h')
-rw-r--r--libs/rs/rsLocklessFifo.h29
1 files changed, 7 insertions, 22 deletions
diff --git a/libs/rs/rsLocklessFifo.h b/libs/rs/rsLocklessFifo.h
index d0a4356..c963963 100644
--- a/libs/rs/rsLocklessFifo.h
+++ b/libs/rs/rsLocklessFifo.h
@@ -19,8 +19,10 @@
#include "rsUtils.h"
+#include "rsSignal.h"
namespace android {
+namespace renderscript {
// A simple FIFO to be used as a producer / consumer between two
@@ -28,8 +30,7 @@ namespace android {
// will not require locking. It is not threadsafe for multiple
// readers or writers by design.
-class LocklessCommandFifo
-{
+class LocklessCommandFifo {
public:
bool init(uint32_t size);
void shutdown();
@@ -37,24 +38,7 @@ public:
LocklessCommandFifo();
~LocklessCommandFifo();
-
protected:
- class Signal {
- public:
- Signal();
- ~Signal();
-
- bool init();
-
- void set();
- void wait();
-
- protected:
- bool mSet;
- pthread_mutex_t mMutex;
- pthread_cond_t mCondition;
- };
-
uint8_t * volatile mPut;
uint8_t * volatile mGet;
uint8_t * mBuffer;
@@ -65,27 +49,28 @@ protected:
Signal mSignalToWorker;
Signal mSignalToControl;
-
-
public:
void * reserve(uint32_t bytes);
void commit(uint32_t command, uint32_t bytes);
void commitSync(uint32_t command, uint32_t bytes);
void flush();
+ void wait();
+
const void * get(uint32_t *command, uint32_t *bytesData);
void next();
void makeSpace(uint32_t bytes);
+ bool makeSpaceNonBlocking(uint32_t bytes);
bool isEmpty() const;
uint32_t getFreeSpace() const;
-
private:
void dumpState(const char *) const;
};
}
+}
#endif