| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#ifndef ANDROID_FENCE_H |
| 18 |
#define ANDROID_FENCE_H |
| 19 |
|
| 20 |
#include <utils/String8.h> |
| 21 |
#include <utils/RefBase.h> |
| 22 |
|
| 23 |
typedef int64_t nsecs_t; |
| 24 |
|
| 25 |
namespace android { |
| 26 |
|
| 27 |
class Fence : public LightRefBase<Fence> { |
| 28 |
public: |
| 29 |
Fence() { } |
| 30 |
Fence(int) { } |
| 31 |
static const sp<Fence> NO_FENCE; |
| 32 |
static constexpr nsecs_t SIGNAL_TIME_PENDING = INT64_MAX; |
| 33 |
static constexpr nsecs_t SIGNAL_TIME_INVALID = -1; |
| 34 |
static sp<Fence> merge(const char* name, const sp<Fence>& f1, const sp<Fence>& f2) { |
| 35 |
return NO_FENCE; |
| 36 |
} |
| 37 |
|
| 38 |
static sp<Fence> merge(const String8& name, const sp<Fence>& f1, const sp<Fence>& f2) { |
| 39 |
return NO_FENCE; |
| 40 |
} |
| 41 |
|
| 42 |
enum class Status { |
| 43 |
Invalid, |
| 44 |
Unsignaled, |
| 45 |
Signaled, |
| 46 |
}; |
| 47 |
|
| 48 |
status_t wait(int timeout) { return OK; } |
| 49 |
|
| 50 |
status_t waitForever(const char* logname) { return OK; } |
| 51 |
|
| 52 |
int dup() const { return 0; } |
| 53 |
|
| 54 |
inline Status getStatus() { |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
switch (wait(0)) { |
| 60 |
case NO_ERROR: |
| 61 |
return Status::Signaled; |
| 62 |
case -ETIME: |
| 63 |
return Status::Unsignaled; |
| 64 |
default: |
| 65 |
return Status::Invalid; |
| 66 |
} |
| 67 |
} |
| 68 |
}; |
| 69 |
|
| 70 |
} |
| 71 |
|
| 72 |
#endif |