diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj index 9895bf2f42..3e6921ddbe 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj +++ b/Builds/VisualStudio2013/RippleD.vcxproj @@ -1955,10 +1955,6 @@ - - True - True - @@ -2063,8 +2059,6 @@ - - @@ -2268,17 +2262,20 @@ True - True + True + True - True + True + True True True - True + True + True @@ -2299,13 +2296,16 @@ True - True + True + True - True + True + True - True + True + True @@ -3461,7 +3461,9 @@ + ..\..\src\websocketpp;%(AdditionalIncludeDirectories) ..\..\src\websocketpp;%(AdditionalIncludeDirectories) + ..\..\src\websocketpp;%(AdditionalIncludeDirectories) ..\..\src\websocketpp;%(AdditionalIncludeDirectories) diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters index b7df54a882..7fb871e71c 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters @@ -319,9 +319,6 @@ {50FDCDC1-EC9C-9F3B-34C9-EF4137E132B4} - - {CE578C3A-4F3A-7E66-FFC5-0C94982FB975} - {B8720E2F-21B1-2847-F96C-4E00A45DC639} @@ -2700,9 +2697,6 @@ ripple\app\tx - - ripple\app\websocket - ripple\basics @@ -2817,9 +2811,6 @@ ripple\basics - - ripple\basics - ripple\basics diff --git a/src/ripple/basics/LoggedTimings.h b/src/ripple/basics/LoggedTimings.h index 16dcdea8b2..4260ea8f3e 100644 --- a/src/ripple/basics/LoggedTimings.h +++ b/src/ripple/basics/LoggedTimings.h @@ -24,7 +24,6 @@ #include #include #include -#include namespace ripple { @@ -58,17 +57,6 @@ struct Destroyer > } }; -/** Specialization for SyncUnorderedMapType -*/ -template -struct Destroyer > -{ - static void destroy (SyncUnorderedMapType & v) - { - v.clear (); - } -}; - /** Cleans up an elaspsed time so it prints nicely */ inline double cleanElapsed (double seconds) noexcept { diff --git a/src/ripple/basics/SyncUnorderedMap.h b/src/ripple/basics/SyncUnorderedMap.h deleted file mode 100644 index 4e242cc4ce..0000000000 --- a/src/ripple/basics/SyncUnorderedMap.h +++ /dev/null @@ -1,162 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef RIPPLE_BASICS_SYNCUNORDEREDMAP_H_INCLUDED -#define RIPPLE_BASICS_SYNCUNORDEREDMAP_H_INCLUDED - -#include -#include - -namespace ripple { - -// Common base -class SyncUnorderedMap -{ -public: - typedef std::recursive_mutex LockType; - typedef std::lock_guard ScopedLockType; -}; - -/** This is a synchronized unordered map. - It is useful for cases where an unordered map contains all - or a subset of an unchanging data set. -*/ - -template > -class SyncUnorderedMapType : public SyncUnorderedMap -{ -public: - typedef c_Key key_type; - typedef c_Data data_type; - typedef hash_map map_type; - - class iterator - { - public: - bool operator== (const iterator& i) { return it == i.it; } - bool operator!= (const iterator& i) { return it != i.it; } - key_type const& key () { return it.first; } - data_type& data () { return it.second; } - - protected: - typename map_type::iterator it; - }; - -public: - typedef SyncUnorderedMap::LockType LockType; - typedef SyncUnorderedMap::ScopedLockType ScopedLockType; - - SyncUnorderedMapType (const SyncUnorderedMapType& m) - { - ScopedLockType sl (m.mLock); - mMap = m.mMap; - } - - SyncUnorderedMapType () - { ; } - - // Operations that are not inherently synchronous safe - // (Usually because they can change the contents of the map or - // invalidated its members.) - - void operator= (const SyncUnorderedMapType& m) - { - ScopedLockType sl (m.mLock); - mMap = m.mMap; - } - - void clear () - { - mMap.clear(); - } - - int erase (key_type const& key) - { - return mMap.erase (key); - } - - void erase (iterator& iterator) - { - mMap.erase (iterator.it); - } - - void replace (key_type const& key, data_type const& data) - { - mMap[key] = data; - } - - void rehash (int s) - { - mMap.rehash (s); - } - - map_type& peekMap () - { - return mMap; - } - - // Operations that are inherently synchronous safe - - std::size_t size () const - { - ScopedLockType sl (mLock); - return mMap.size (); - } - - // If the value is already in the map, replace it with the old value - // Otherwise, store the value passed. - // Returns 'true' if the value was added to the map - bool canonicalize (key_type const& key, data_type* value) - { - ScopedLockType sl (mLock); - - auto it = mMap.emplace (key, *value); - - if (!it.second) // Value was not added, take existing value - *value = it.first->second; - - return it.second; - } - - // Retrieve the existing value from the map. - // If none, return an 'empty' value - data_type retrieve (key_type const& key) - { - data_type ret; - - { - ScopedLockType sl (mLock); - - auto it = mMap.find (key); - - if (it != mMap.end ()) - ret = it->second; - } - - return ret; - } - -private: - map_type mMap; - mutable LockType mLock; -}; - -} // ripple - -#endif diff --git a/src/ripple/shamap/README.md b/src/ripple/shamap/README.md index d6497cc406..e28d3bbfc3 100644 --- a/src/ripple/shamap/README.md +++ b/src/ripple/shamap/README.md @@ -72,6 +72,8 @@ be modified must be copied before they are placed in the mutable map. ## SHAMap Thread Safety ## +*This description is obsolete and needs to be rewritten.* + SHAMaps can be thread safe, depending on how they are used. The SHAMap uses a SyncUnorderedMap for its storage. The SyncUnorderedMap has three thread-safe methods: