GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - bas524/ConcurrentHashMap: Concurrent HashMap C++

BranchesTags
Open more actions menu

Latest commit

 

History

10 Commits
10 Commits

Folders and files

NameName
Last commit message
Last commit date
.clang-format
.clang-format
 
 
.gitignore
.gitignore
 
 
CMakeLists.txt
CMakeLists.txt
 
 
ConcurrentHashMap.h
ConcurrentHashMap.h
 
 
README.md
README.md
 
 
main.cpp
main.cpp
 
 

Repository files navigation

ConcurrentHashMap

ConcurrentHashMap implementation with functional (lambda) signatures. For read-write locks I used std::shared_timed_mutex. C++14 requred.

Example

#include <iostream>
#include <thread>
#include "ConcurrentHashMap.h"

int main() {
  using TestMapType = ConcurrentHashMap<int, std::string>;

  TestMapType concurrentHashMap;

  for (int i = 0; i < 10000; ++i) {
    concurrentHashMap.insert(i, std::to_string(i));
  }
  
  std::cout << " --------------- " << std::endl;

  std::thread thr1([&concurrentHashMap]() { concurrentHashMap.doForEeach([](TestMapType::ValueType &pair) { pair.second.append("+1"); }); });

  std::thread thr2([&concurrentHashMap]() { concurrentHashMap.doForEeach([](TestMapType::ValueType &pair) { pair.second.append("+2"); }); });

  thr1.join();
  thr2.join();

  concurrentHashMap.doForEeach([](const TestMapType::ValueType &pair) { std::cout << pair.first << " [" << pair.second << "]" << std::endl; });

  std::cout << " --------------- " << std::endl;
}

About

Concurrent HashMap C++

Topics

concurrencylambdaunordered-map

Resources

Readme
Activity

Stars

3 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.