osrm-backend/include/util
Michael Krasnyk c8b75c9046 Use thread-safe lock-free assignment in PackedVector::set_value
PR uses TBB internal atomic's for atomic CAS on non-atomic data

Corresponding PR https://github.com/Project-OSRM/osrm-backend/pull/4199

Other options:

* use sequential update

* use an internal packed vector lock -> makes packed vector non-movable

* use boost.interprocess atomics implementation -> outdated and only 32 bit version

* use glib atomic's -> requires new dependency

*  wait for https://isocpp.org/blog/2014/05/n4013 as_atomic

*  use c11 _Atomic and atomic_compare_exchange_weak -> not possible to mix c++11 and c11

* use builtin functions gcc __sync_bool_compare_and_swap and msvc _InterlockedCompareExchange64 -> possible, but requires proper testing

boolean CompareAndSwapPointer(volatile * void * ptr,
                              void * new_value,
                              void * old_value) {
if defined(_MSC_VER)
   if (InterlockedCompareExchange(ptr, new_value, old_value) == old_value) return false;
   else return true;
elif (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100
   return __sync_bool_compare_and_swap(ptr, old_value, new_value);
else
  error No implementation
endif
}

* use Boost.Atomic -> requires new dependency

        WordT local_lower_word = lower_word, new_lower_word;
        do
        {
            new_lower_word = set_lower_value<WordT, T>(local_lower_word,
                                                       lower_mask[internal_index.element],
                                                       lower_offset[internal_index.element],
                                                       value);
        } while (!boost::atomics::detail::operations<sizeof(WordT), false>::compare_exchange_weak(
            lower_word,
            local_lower_word,
            new_lower_word,
            boost::memory_order_release,
            boost::memory_order_relaxed));
2017-06-27 13:02:53 +02:00
..
guidance Make EMPTY_ENTRY_CLASS constexpr 2017-06-27 09:58:19 +00:00
alias.hpp Address PR comments 2017-04-24 16:04:41 +00:00
assert.hpp Fix OSRM_ASSERT_MSG compilation fail in Release mode 2017-05-17 15:52:11 +00:00
attributes.hpp adjust testscases for collapse of use lane 2016-09-07 12:17:36 +02:00
bearing.hpp Simplify angleBetween to avoid cancellation losses 2017-05-17 15:52:11 +00:00
cast.hpp Format with clang-format 3.8 2016-05-27 21:05:04 +02:00
concurrent_id_map.hpp Avoid dead-lock if other = this 2017-06-27 09:58:19 +00:00
conditional_restrictions.hpp Conditional turn restriction support (#3841) 2017-05-11 12:13:52 +02:00
container.hpp Add headers consistency check 2016-12-15 10:58:17 +01:00
coordinate_calculation.hpp refactor merging of segregated roads 2017-01-03 12:32:51 +01:00
coordinate.hpp Bypass boost::numeric_cast checks for coordinate values that have already been validated (#4059) 2017-05-19 10:52:44 -07:00
deallocating_vector.hpp Explicitly implement move constructor for DeallocationVector 2017-06-23 09:22:30 +00:00
debug.hpp refactor of post-processing 2017-02-25 12:17:22 +00:00
dist_table_wrapper.hpp Trip with Fixed Start and End points (TFSE) (#3408) 2017-02-10 05:13:20 -05:00
dynamic_graph.hpp Renumber nodes after running osrm-partition 2017-06-02 18:12:13 +00:00
exception_utils.hpp Make most command-line tools return useful error codes on well-known exceptions. 2017-06-08 15:03:24 +00:00
exception.hpp Make most command-line tools return useful error codes on well-known exceptions. 2017-06-08 15:03:24 +00:00
fingerprint.hpp Allow specifing a weight for routing that is independent of duration 2017-01-27 11:19:37 +01:00
for_each_pair.hpp Takes fn by forwarding ref. in for_each_pair, resolves #4148 2017-06-14 15:17:26 +00:00
for_each_range.hpp Add storage for cell weights used in the MLD algorithm 2017-02-20 16:31:36 +00:00
geojson_debug_logger.hpp Fixes various compiler diagnostics 2017-01-06 16:47:52 +01:00
geojson_debug_policies.hpp add a geojson debugger that allows creating features for easy inspection 2016-11-02 14:54:00 +01:00
geojson_debug_policy_toolkit.hpp Add headers consistency check 2016-12-15 10:58:17 +01:00
geojson_validation.hpp Fix PR comments 2017-06-02 18:46:21 +00:00
graph_loader.hpp Conditional turn restriction support (#3841) 2017-05-11 12:13:52 +02:00
graph_traits.hpp Loads the edge based graph edges and constructs a dynamic graph from it 2017-03-01 16:09:29 +00:00
graph_utils.hpp Add namespace around all files 2016-01-08 01:30:52 +01:00
group_by.hpp Anticipate Lane Changes 2016-06-27 10:07:43 +02:00
hilbert_value.hpp Refactor Hilbert values computation 2016-11-28 14:17:12 +01:00
indexed_data.hpp Use FileWriter for better error handling when writing name data. 2017-05-29 15:09:36 +00:00
integer_range.hpp Make osrm::util::range a model of SinglePassRangeConcept 2017-01-03 10:22:03 +01:00
isatty.hpp Conditionally checks std::is_trivially_copyable only if available. (#3327) 2016-11-16 12:07:45 -08:00
json_container.hpp Variant got re-packaged, need to update search paths. (#3392) 2016-12-01 16:59:29 -08:00
json_deep_compare.hpp Silence static visitor upstream deprecation warnings. 2016-10-06 21:08:48 +02:00
json_renderer.hpp Format with clang-format 3.8 2016-05-27 21:05:04 +02:00
json_util.hpp Fix compile on OS X 2016-04-05 22:58:32 +02:00
log.hpp Refactor logging, improve error handling workflow, clang-format. (#3385) 2016-12-06 12:30:46 -08:00
lua_util.hpp Clean plate: luabind ripped out and sol2 basic integration 2016-12-15 10:55:16 +01:00
matrix_graph_wrapper.hpp Trip with Fixed Start and End points (TFSE) (#3408) 2017-02-10 05:13:20 -05:00
meminfo.hpp Dump memory usage stats after partitioning. 2017-03-01 16:09:29 +00:00
mmap_file.hpp Renumber nodes after running osrm-partition 2017-06-02 18:12:13 +00:00
msb.hpp fix clang format style 2017-03-08 00:56:50 +00:00
name_table.hpp No shared_memory_wrapper, (De)SerializeVector 2017-04-06 15:42:38 +00:00
node_based_graph.hpp expose data about turning onto restricted roads to turn function 2017-02-20 12:40:51 +00:00
opening_hours.hpp Conditional turn restriction support (#3841) 2017-05-11 12:13:52 +02:00
packed_vector.hpp Use thread-safe lock-free assignment in PackedVector::set_value 2017-06-27 13:02:53 +02:00
percent.hpp Refactor logging, improve error handling workflow, clang-format. (#3385) 2016-12-06 12:30:46 -08:00
permutation.hpp Renumber nodes after running osrm-partition 2017-06-02 18:12:13 +00:00
query_heap.hpp Rename BinaryHeap to QueryHeap 2017-05-02 15:54:25 +00:00
range_table.hpp Port isc file 2017-06-27 09:58:19 +00:00
rectangle.hpp Refactor RTree so that .fileIndex only contains EdgeDataT, and all r-tree structure is in the .ramIndex file. 2017-06-02 12:15:06 +00:00
serialization.hpp Port isc file 2017-06-27 09:58:19 +00:00
static_graph.hpp Renumber nodes after running osrm-partition 2017-06-02 18:12:13 +00:00
static_rtree.hpp Renumber nodes after running osrm-partition 2017-06-02 18:12:13 +00:00
std_hash.hpp Anonymous namespaces in header files are bad 2016-01-19 17:42:49 +01:00
string_util.hpp Format with clang-format 3.8 2016-05-27 21:05:04 +02:00
string_view.hpp Implements Zero-Copy String Views onto Contiguous Memory, resolves #3265. 2017-01-23 15:22:39 +01:00
timed_histogram.hpp Renumber nodes after running osrm-partition 2017-06-02 18:12:13 +00:00
timezones.hpp deps and lint 2017-06-02 10:00:07 +02:00
timing_util.hpp Remove obsolete timer code 2016-05-26 20:25:33 +02:00
trigonometry_table.hpp Format with clang-format 3.8 2016-05-27 21:05:04 +02:00
typedefs.hpp Switch code to use packed vector for segment weights/durations 2017-05-19 08:25:03 +00:00
vector_tile.hpp Fix buffering of query box - it was shrinking in the Y axis, rather than growing. 2016-11-08 11:45:28 -08:00
vector_view.hpp Refactor file writing in OSRM contract 2017-06-23 09:22:30 +00:00
version.hpp.in Replace fingerprint with semver-based scheme. (#3467) 2017-01-06 13:45:08 -08:00
viewport.hpp One-Definition-Rule violation in viewport 2016-04-12 12:17:52 +02:00
web_mercator.hpp Fix possible division by zero by clamping latitude to 85.05° 2017-01-12 16:44:58 +01:00
xor_fast_hash_storage.hpp Adapts XORFastHashStorage to XORFastHash compile time limits 2016-01-26 17:54:08 +01:00
xor_fast_hash.hpp Format with clang-format 3.8 2016-05-27 21:05:04 +02:00