Giter Site home page Giter Site logo

dnedic / lockfree Goto Github PK

View Code? Open in Web Editor NEW
757.0 14.0 46.0 627 KB

A collection of lock-free data structures written in standard C++11

License: MIT License

CMake 2.31% C++ 97.69%
circular-buffer cpp cpp11 bipartite circular-queue dma embedded embedded-systems inter-process-communication queue

lockfree's People

Contributors

dnedic avatar drdub avatar lnnrts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lockfree's Issues

Visual Studio expands the __cplusplus macro to 199711L by default regardless of C++ std being used.

https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-170

Using the /Zc:__cplusplus compiler option forces visual studio to set this macro properly.

NOTE: I was able to add lockfree to a project with C++17 support using CPMAddPackage with the following:

CPMAddPackage(
    NAME lockfree
    GITHUB_REPOSITORY DNedic/lockfree
    GIT_TAG 2.0.2
)
if (lockfree_ADDED AND MSVC)
    target_compile_options(lockfree INTERFACE "/Zc:__cplusplus")
endif()

README should mention C++20 is needed to run tests

tests/CMakeLists.txt contains the following lines:

 # Required in order to test the std::span API as well
target_compile_features(tests PRIVATE cxx_std_20)

In particular, the tests do not compile with gcc-10.

There are no 'How it works' sections in data structure READMEs

In order to help both users, curious bystanders or people looking to contribute, we should have sections explaining how data structures work under the hood, prefferably with diagrams included.

For data structures that are widely used and documented, like the spsc::Queue, it might not be necessary.

Are the tests done using multiple threads?

First of all, thanks for the great library.
I'm [possibly] planning to use it, but I'm just wondering about one thing...

Looking at the tests, it seems like they aren't done using multiple threads, but rather on a single one.
Am I missing something?

Comipe error of missing header file of std::pair<> in "bipartitte_buf.hpp"

I add this project as a subproject into my code. But occur compile error:

"[build] In file included from /home/host/work/cpp/cppcore11/depend/lockfree/lockfree/lockfree.hpp:54:0,
[build] from /home/host/work/cpp/cppcore11/gtest/lock_free_test.cc:1:
[build] /home/host/work/cpp/cppcore11/depend/lockfree/lockfree/spsc/bipartite_buf.hpp:106:10: error: ‘pair’ in namespace ‘std’ does not name a template type
[build] std::pair<T , size_t> ReadAcquire();
[build] ^~~~
[build] In file included from /home/host/work/cpp/cppcore11/depend/lockfree/lockfree/spsc/bipartite_buf.hpp:163:0,
[build] from /home/host/work/cpp/cppcore11/depend/lockfree/lockfree/lockfree.hpp:54,
[build] from /home/host/work/cpp/cppcore11/gtest/lock_free_test.cc:1:
[build] /home/host/work/cpp/cppcore11/depend/lockfree/lockfree/spsc/bipartite_buf_impl.hpp:114:59: error: no ‘std::pair<T, long unsigned int> lockfree::spsc::BipartiteBuf<T, size>::ReadAcquire()’ member function declared in class ‘lockfree::spsc::BipartiteBuf<T, size>’
[build] std::pair<T *, size_t> BipartiteBuf<T, size>::ReadAcquire() {
[build] ^
[build] Scanning dependencies of target gmock_main
[build] [ 41%] Building CXX object depend/googletest/googlemock/CMakeFiles/gmock_main.dir/src/gmock_main.cc.o
[build] make[2]: *** [CMakeFiles/base_unittest.dir/build.make:115: CMakeFiles/base_unittest.dir/gtest/lock_free_test.cc.o] Error 1
[build] make[1]: *** [CMakeFiles/Makefile2:170: CMakeFiles/base_unittest.dir/all] Error 2
[build] make[1]: *** Waiting for unfinished jobs...."

My env:
GCC: 7.5.0
System: Ubuntu 20.04

I fixed this error by add header file "utility" to "bipartitte_buf.hpp"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.