diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-10-04 18:15:16 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-10-04 18:15:16 +0000 |
commit | 2360000a33e11c2745a7e0b30fd4187b70838bde (patch) | |
tree | f67e88b0a04528e3b7dae88b73a7e18c85b9e1e9 /apps | |
parent | 5ed769436764f1e62149c2fae6c24eda310a3b05 (diff) | |
download | ATCD-2360000a33e11c2745a7e0b30fd4187b70838bde.tar.gz |
ChangeLogTag:Tue Oct 4 11:12:31 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/JAWS2/JAWS/Cache_Object.cpp | 18 | ||||
-rw-r--r-- | apps/JAWS2/JAWS/Cache_Object.h | 16 |
2 files changed, 19 insertions, 15 deletions
diff --git a/apps/JAWS2/JAWS/Cache_Object.cpp b/apps/JAWS2/JAWS/Cache_Object.cpp index bb1a258ef2d..651e2bc5bd9 100644 --- a/apps/JAWS2/JAWS/Cache_Object.cpp +++ b/apps/JAWS2/JAWS/Cache_Object.cpp @@ -1,8 +1,13 @@ // $Id$ #include "JAWS/Cache_Object.h" + +#include "ace/Malloc_Base.h" +#include "ace/Guard_T.h" #include "ace/OS_NS_time.h" + + JAWS_Cache_Object::JAWS_Cache_Object (const void *data, size_t size) : internal_ (0), data_ (data), @@ -113,10 +118,7 @@ JAWS_Referenced_Cache_Object::lock (void) unsigned int JAWS_Referenced_Cache_Object::count_i (void) const { - JAWS_Referenced_Cache_Object *mutable_this - = (JAWS_Referenced_Cache_Object *) this; - - if (mutable_this->count_.tryacquire_write () == 0) + if (this->count_.tryacquire_write () == 0) return 0; return 1; @@ -171,13 +173,9 @@ JAWS_Counted_Cache_Object::lock (void) unsigned int JAWS_Counted_Cache_Object::count_i (void) const { - JAWS_Counted_Cache_Object *mutable_this = (JAWS_Counted_Cache_Object *) this; - - { - ACE_Guard<ACE_SYNCH_MUTEX> g (mutable_this->lock_); + ACE_Guard<ACE_SYNCH_MUTEX> g (this->lock_); - return this->count_; - } + return this->count_; } int diff --git a/apps/JAWS2/JAWS/Cache_Object.h b/apps/JAWS2/JAWS/Cache_Object.h index 96a9cfa096c..b1f585b5119 100644 --- a/apps/JAWS2/JAWS/Cache_Object.h +++ b/apps/JAWS2/JAWS/Cache_Object.h @@ -1,4 +1,5 @@ -/* -*- c++ -*- */ +// -*- C++ -*- + // $Id$ @@ -9,6 +10,11 @@ #include "ace/Synch_Traits.h" #include "ace/Thread_Mutex.h" #include "ace/Malloc.h" +#include "ace/RW_Thread_Mutex.h" + + +class ACE_Allocator; + // Cache bucket -- use Hash_Bucket to hold cacheable objects. @@ -78,8 +84,8 @@ protected: private: - /* MUTABLE */ ACE_SYNCH_RW_MUTEX count_; - /* MUTABLE */ ACE_Lock_Adapter<ACE_SYNCH_RW_MUTEX> lock_adapter_; + mutable ACE_SYNCH_RW_MUTEX count_; + mutable ACE_Lock_Adapter<ACE_SYNCH_RW_MUTEX> lock_adapter_; }; @@ -102,8 +108,8 @@ private: unsigned int count_; unsigned int new_count_; - /* MUTABLE */ ACE_SYNCH_MUTEX lock_; - /* MUTABLE */ ACE_Lock_Adapter<ACE_SYNCH_MUTEX> lock_adapter_; + mutable ACE_SYNCH_MUTEX lock_; + mutable ACE_Lock_Adapter<ACE_SYNCH_MUTEX> lock_adapter_; }; |