BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
39461e8
Branches
Tags
master
Blinker
src
common
Lock.h
implement lock and lock manager
Stefan Schuermans
commited
39461e8
at 2019-08-13 18:30:31
Lock.h
Blame
History
Raw
/* Blinker Copyright 2011-2019 Stefan Schuermans <stefan@blinkenarea.org> Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html a blinkenarea.org project */ #ifndef BLINKER_LOCK_H #define BLINKER_LOCK_H namespace Blinker { /// a mutual exclusion lock (easy, because Blinker is single-threaded) class Lock { public: /// constructor Lock(); /// destructor ~Lock(); private: /// copy constructor disabled Lock(const Lock &that); /// assignment operator disabled const Lock & operator=(const Lock &that); public: /** * @brief check if locked * @return whether lock is taken */ bool islocked() const; /** * @brief lock if not locked * @return whether lock could be acquired */ bool trylock(); /// unlock (if locked) void unlock(); private: bool m_locked; ///< whether lock is locked }; // class Lock } // namespace Blinker #endif // #ifndef BLINKER_LOCK_H