diff options
author | Tycho Bickerstaff <work.tycho@gmail.com> | 2013-12-31 17:13:13 +0100 |
---|---|---|
committer | Tycho Bickerstaff <work.tycho@gmail.com> | 2013-12-31 17:13:13 +0100 |
commit | 098ed91a48df9fef58590b22fe34225ed1f44cfa (patch) | |
tree | 0bd8fff5833d6b6636195ee73faaced13ddcba90 /src/OSSupport/Promise.h | |
parent | clean up code for patching (diff) | |
download | cuberite-098ed91a48df9fef58590b22fe34225ed1f44cfa.tar cuberite-098ed91a48df9fef58590b22fe34225ed1f44cfa.tar.gz cuberite-098ed91a48df9fef58590b22fe34225ed1f44cfa.tar.bz2 cuberite-098ed91a48df9fef58590b22fe34225ed1f44cfa.tar.lz cuberite-098ed91a48df9fef58590b22fe34225ed1f44cfa.tar.xz cuberite-098ed91a48df9fef58590b22fe34225ed1f44cfa.tar.zst cuberite-098ed91a48df9fef58590b22fe34225ed1f44cfa.zip |
Diffstat (limited to '')
-rw-r--r-- | src/OSSupport/Promise.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/OSSupport/Promise.h b/src/OSSupport/Promise.h new file mode 100644 index 000000000..83d04860b --- /dev/null +++ b/src/OSSupport/Promise.h @@ -0,0 +1,38 @@ +#pragma once + +class cCombinedPromise; + + +class cPromise { + public: + cPromise() {} + virtual ~cPromise () {} + cPromise * WaitFor(cPromise * a_Promise); + cPromise * CancelOn(volatile bool& cancelationtoken); + void Wait(); + virtual bool IsCompleted() = 0; + //TODO:Expose Events for waiting on +}; + +class cCombinedPromise : public cPromise { +public: + cCombinedPromise(cPromise*, cPromise*); + ~cCombinedPromise(); + virtual bool IsCompleted(); +private: + cPromise* m_left; + cPromise* m_right; +}; + +class cCancelablePromise : public cPromise { +public: + cCancelablePromise(cPromise*, volatile bool&); + ~cCancelablePromise(); + virtual bool IsCompleted(); +private: + volatile bool& m_cancel; + cPromise* m_wrapped; +}; + + + |