BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
39461e8
Branches
Tags
master
Blinker
src
common
Lock.cpp
implement lock and lock manager
Stefan Schuermans
commited
39461e8
at 2019-08-13 18:30:31
Lock.cpp
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 */ #include "Lock.h" namespace Blinker { /// constructor Lock::Lock(): m_locked(false) { } /// destructor Lock::~Lock() { } /** * @brief check if locked * @return whether lock is taken */ bool Lock::islocked() const { return m_locked; } /** * @brief lock if not locked * @return whether lock could be acquired */ bool Lock::trylock() { if (m_locked) { return false; } m_locked = true; return true; } /// unlock (if locked) void Lock::unlock() { m_locked = false; } } // namespace Blinker