locks.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. /// This file (right now) provides dummy locks
  15. /// It also contains code to use boost/threads locks:
  16. ///
  17. ///
  18. /// All locks are dummy classes that don't actually do anything. At this moment,
  19. /// only the very minimal set of methods that we actually use is defined.
  20. ///
  21. /// Note that we need to include <config.h> in our .cc files for that
  22. /// to be set. we might want to enfore this at compile time with a check
  23. /// (TODO)
  24. #ifndef __LOCKS_
  25. #define __LOCKS_
  26. namespace isc {
  27. namespace util {
  28. namespace locks {
  29. class mutex {
  30. };
  31. class recursive_mutex {
  32. };
  33. class upgradable_mutex {
  34. };
  35. template <typename T>
  36. class sharable_lock {
  37. public:
  38. sharable_lock(T) { }
  39. };
  40. template <typename T>
  41. class scoped_lock {
  42. public:
  43. scoped_lock(T) { }
  44. void lock() {}
  45. void unlock() {}
  46. };
  47. } // namespace locks
  48. } // namespace util
  49. } // namespace isc
  50. #endif // __LOCKS_