diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-01 05:24:54 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-01 05:24:54 +0000 |
commit | 9f187b46ae761e8275362d6c1533e9fe79028c7b (patch) | |
tree | e2625f63e0c84f172c877e1fe2cbe75adf678208 /cpp/sca/kernel/function.hpp | |
parent | 24021bd09a0d5c9664565a244c24e0bdef0908b8 (diff) |
Improved memory management using APR memory pools, changed frame allocation in eval library to support forward references and fixed memory leak in XML parsing code. Also simplified a bit the printing of lists to make them easier to read.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@831639 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/sca/kernel/function.hpp')
-rw-r--r-- | cpp/sca/kernel/function.hpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/cpp/sca/kernel/function.hpp b/cpp/sca/kernel/function.hpp index 9492879e5e..c99ee5dbad 100644 --- a/cpp/sca/kernel/function.hpp +++ b/cpp/sca/kernel/function.hpp @@ -64,8 +64,6 @@ bool printLambdaCounters() { template<typename R, typename... P> class Callable { public: - unsigned int refCount; - Callable() : refCount(0) { } @@ -76,14 +74,6 @@ public: virtual ~Callable() { } - unsigned int acquire() { - return __sync_add_and_fetch(&refCount, 1); - } - - unsigned int release() { - return __sync_sub_and_fetch(&refCount, 1); - } - template<typename F> class Proxy: public Callable { public: Proxy(const F& f) : function(f) { @@ -112,6 +102,18 @@ public: const F function; }; +private: + friend class gc_counting_ptr<Callable>; + + unsigned int refCount; + + unsigned int acquire() { + return __sync_add_and_fetch(&refCount, 1); + } + + unsigned int release() { + return __sync_sub_and_fetch(&refCount, 1); + } }; template<typename S> class lambda; |