gc.inline.h 667 B

1234567891011121314151617181920212223242526272829
  1. #ifndef AFUN_GC_INLINE_H
  2. #define AFUN_GC_INLINE_H
  3. #include "gc.h"
  4. namespace aFuncore {
  5. inline GcObjectBase::GcObjectBase() : not_clear{false}, reference{1}, reachable{false}, done_destruct{false} {
  6. }
  7. inline void GcObjectBase::addReference() {
  8. std::unique_lock<std::mutex> mutex{lock};
  9. reference++;
  10. }
  11. inline void GcObjectBase::delReference() {
  12. std::unique_lock<std::mutex> mutex{lock};
  13. reference--;
  14. }
  15. inline GcCount GcObjectBase::getReference() const {
  16. return reference;
  17. }
  18. inline void GcObjectBase::setClear(bool clear) {
  19. not_clear=!clear;
  20. }
  21. }
  22. #endif //AFUN_GC_INLINE_H