aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/use_count_checker.h
blob: 9437bace987e1619d86f280cb568158e0321a5e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once 
 
#include <util/generic/refcount.h> 
 
class TUseCountChecker { 
private: 
    TAtomicCounter Counter; 

public: 
    TUseCountChecker(); 
    ~TUseCountChecker(); 
    void Inc(); 
    void Dec(); 
}; 
 
class TUseCountHolder { 
private: 
    TUseCountChecker* CurrentChecker; 

public: 
    TUseCountHolder(); 
    explicit TUseCountHolder(TUseCountChecker* currentChecker); 
    TUseCountHolder& operator=(TUseCountHolder that); 
    ~TUseCountHolder(); 
    void Swap(TUseCountHolder&); 
    void Reset(); 
};