From b27bb5d43bb118b45bd13fbc0ff6abacb4eaba03 Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 17 Mar 2009 13:57:46 +0000 Subject: [PATCH] LazyUpdate single-threaded version git-svn-id: svn://ultimatepp.org/upp/trunk@969 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Mt.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/uppsrc/Core/Mt.h b/uppsrc/Core/Mt.h index 02ff23923..c5f8aa38e 100644 --- a/uppsrc/Core/Mt.h +++ b/uppsrc/Core/Mt.h @@ -479,6 +479,17 @@ struct RWMutex::WriteLock : NoCopy { typedef RWMutex StaticRWMutex; +struct LazyUpdate { + mutable bool dirty; + +public: + void Invalidate() { dirty = true; } + bool BeginUpdate() const { return dirty; } + void EndUpdate() const { dirty = false; } + + LazyUpdate() { dirty = true; } +}; + #define INTERLOCKED #define INTERLOCKED_(x) { x.Enter(); }