LockGuard.hpp 809 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // ======================================================================
  2. // \title LockGuard.hpp
  3. // \author vwong
  4. // \brief hpp file for a RAII-style lock guard utility class
  5. //
  6. // \copyright
  7. // Copyright (C) 2009-2020 California Institute of Technology.
  8. // ALL RIGHTS RESERVED. United States Government Sponsorship
  9. // acknowledged.
  10. // ======================================================================
  11. #ifndef LockGuard_HPP
  12. #define LockGuard_HPP
  13. #include <FpConfig.hpp>
  14. #include <Os/Mutex.hpp>
  15. namespace Utils {
  16. class LockGuard
  17. {
  18. public:
  19. // Construct and lock associated mutex
  20. LockGuard(Os::Mutex& mutex);
  21. // Destruct and unlock associated mutex
  22. ~LockGuard();
  23. private:
  24. // parameters
  25. Os::Mutex& m_mutex;
  26. };
  27. } // end namespace Utils
  28. #endif