From 64eaee28c243214e654c60b06a27212e8dcb5c02 Mon Sep 17 00:00:00 2001 From: Sascha Volkenandt Date: Thu, 4 Jan 2007 15:02:00 +0000 Subject: - optimized interface to access plugin objects from website - moved website code to pagelib subdirectory - introduced TimerManager that will help working on timers from a background thread --- pagelib/tools.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 pagelib/tools.h (limited to 'pagelib/tools.h') diff --git a/pagelib/tools.h b/pagelib/tools.h new file mode 100644 index 0000000..f9eb33a --- /dev/null +++ b/pagelib/tools.h @@ -0,0 +1,30 @@ +#ifndef VDR_LIVE_TOOLS_H +#define VDR_LIVE_TOOLS_H + +#include +#include +#include + +namespace vdrlive { + +std::string FormatDateTime( char const* format, time_t time ); + +class ReadLock +{ +public: + ReadLock( cRwLock& lock, int timeout = 100 ): m_lock( lock ), m_locked( false ) { if ( m_lock.Lock( false, timeout ) ) m_locked = true; } + ~ReadLock() { if ( m_locked ) m_lock.Unlock(); } + + operator bool() { return m_locked; } + bool operator!() { return !m_locked; } + +private: + ReadLock( ReadLock const& ); + + cRwLock& m_lock; + bool m_locked; +}; + +} // namespace vdrlive + +#endif // VDR_LIVE_TOOLS_H -- cgit v1.2.3