OLD | NEW |
1 /* | 1 /* |
2 ****************************************************************************** | 2 ****************************************************************************** |
3 * Copyright (C) 2015, International Business Machines | 3 * Copyright (C) 2015, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ****************************************************************************** | 5 ****************************************************************************** |
6 * sharedobject.h | 6 * sharedobject.h |
7 */ | 7 */ |
8 | 8 |
9 #ifndef __SHAREDOBJECT_H__ | 9 #ifndef __SHAREDOBJECT_H__ |
10 #define __SHAREDOBJECT_H__ | 10 #define __SHAREDOBJECT_H__ |
11 | 11 |
12 | 12 |
13 #include "unicode/uobject.h" | 13 #include "unicode/uobject.h" |
14 #include "umutex.h" | 14 #include "umutex.h" |
15 | 15 |
16 U_NAMESPACE_BEGIN | 16 U_NAMESPACE_BEGIN |
17 | 17 |
18 /** | 18 /** |
19 * Base class for unified cache exposing enough methods to SharedObject | 19 * Base class for unified cache exposing enough methods to SharedObject |
20 * instances to allow their addRef() and removeRef() methods to | 20 * instances to allow their addRef() and removeRef() methods to |
21 * update cache metrics. No other part of ICU, except for SharedObject, | 21 * update cache metrics. No other part of ICU, except for SharedObject, |
22 * should directly call the methods of this base class. | 22 * should directly call the methods of this base class. |
23 */ | 23 */ |
24 class UnifiedCacheBase : public UObject { | 24 class U_COMMON_API UnifiedCacheBase : public UObject { |
25 public: | 25 public: |
26 UnifiedCacheBase() { } | 26 UnifiedCacheBase() { } |
27 | 27 |
28 /** | 28 /** |
29 * Called by addRefWhileHoldingCacheLock() when the hard reference count | 29 * Called by addRefWhileHoldingCacheLock() when the hard reference count |
30 * of its instance goes from 0 to 1. | 30 * of its instance goes from 0 to 1. |
31 */ | 31 */ |
32 virtual void incrementItemsInUse() const = 0; | 32 virtual void incrementItemsInUse() const = 0; |
33 | 33 |
34 /** | 34 /** |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 mutable u_atomic_int32_t hardRefCount; | 225 mutable u_atomic_int32_t hardRefCount; |
226 mutable const UnifiedCacheBase *cachePtr; | 226 mutable const UnifiedCacheBase *cachePtr; |
227 void addRef(UBool withCacheLock) const; | 227 void addRef(UBool withCacheLock) const; |
228 void removeRef(UBool withCacheLock) const; | 228 void removeRef(UBool withCacheLock) const; |
229 | 229 |
230 }; | 230 }; |
231 | 231 |
232 U_NAMESPACE_END | 232 U_NAMESPACE_END |
233 | 233 |
234 #endif | 234 #endif |
OLD | NEW |