Giter VIP home page Giter VIP logo

miniasync's Introduction

miniasync: Mini Asynchronous Library

GHA build status Coverage Status Language grade: C/C++ Coverity Scan Build Status

⚠️ Discontinuation of the project

The miniasync project will no longer be maintained by Intel.

  • Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project.
  • Intel no longer accepts patches to this project.
  • If you have an ongoing need to use this project, are interested in independently developing it, or would like to maintain patches for the open source software community, please create your own fork of this project.
  • You will find more information here.

Introduction

The Mini Library for Asynchronous Programming in C is a C low-level concurrency library for asynchronous functions. For more information, see pmem.io.

Building

Requirements:

  • C compiler
  • cmake >= 3.3
  • pkg_config

First, you have to create a build directory. From there you have to prepare the compilation using CMake. The final build step is just a make command.

$ mkdir build && cd build
$ cmake ..
$ make -j

CMake standard options

List of options provided by CMake:

Name Description Values Default
BUILD_EXAMPLES Build the examples ON/OFF ON
BUILD_TESTS Build the tests ON/OFF ON
COVERAGE Run coverage test ON/OFF OFF
DEVELOPER_MODE Enable developer checks ON/OFF OFF
CHECK_CSTYLE Check code style of C sources ON/OFF OFF
TRACE_TESTS More verbose test outputs ON/OFF OFF
USE_ASAN Enable AddressSanitizer ON/OFF OFF
USE_UBSAN Enable UndefinedBehaviorSanitizer ON/OFF OFF
TESTS_USE_VALGRIND Enable tests with valgrind ON/OFF ON
TEST_DIR Working directory for tests dir path ./build/tests
CMAKE_BUILD_TYPE Choose the type of build None/Debug/Release/RelWithDebInfo Debug
COMPILE_DML Compile DML implementation of miniasync ON/OFF OFF

Running

The miniasync library can be found in the build/src directory. You can also run the examples from the build/examples directory.

Testing

After completing the building step, you can run tests by invoking: make test -j or ctest.

To get more verbose output on failure, you can invoke: ctest --output-on-failure.

Tests using Valgrind are switched on by default. To switch them off use: cmake -DTESTS_USE_VALGRIND=OFF ...

The option necessary to run tests BUILD_TESTS is set to ON by default.

Building packages

In order to build 'rpm' or 'deb' packages you should issue the following commands:

$ mkdir build && cd build
$ cmake .. -DCPACK_GENERATOR="$GEN" -DCMAKE_INSTALL_PREFIX=/usr
$ make package

where $GEN is a type of package generator: RPM or DEB.

CMAKE_INSTALL_PREFIX must be set to a destination where packages will be installed.

Contact Us

If you read the blog post and still have some questions (especially about discontinuation of the project), please contact us using the dedicated e-mail: [email protected].

miniasync's People

Contributors

blazej-smorawski avatar kfilipek avatar kilobyte avatar kswiecicki avatar ldorau avatar lplewa avatar lukaszstolarczuk avatar pbalcer avatar szadam avatar tuliom avatar wlemkows avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

miniasync's Issues

Use-after-free when polling a future created in a different thread (with threads_mover)

Consider the following code:

vdm_memcpy_future f;

std::thread t1([&]{
    f = vdm_memcpy(...): // with threads_mover
});
t1.join();

std::thread t2([&]{
    auto f2 = vdm_memcpy(...); // with threads_mover
    while (future_poll(&f, NULL) != FUTURE_STATE_COMPLETE);
});
t2.join();

It will most likely segfault because of use-after free in membuf. Inside t1 data_mover_threads_data is allocated from membuf, in thread-local buffer. When t1 finishes, it will mark the buffer as unused.

Then, inside t2 that same thread-local buffer is reused by f2. future_poll(&f, NULL) will then enqueue data allocated by t1 to the ringbuff and the background thread will process that data (now, already overwritten) leading to a use-after-free.

This problem might also occur for data_mover_sync.c but I did not test that.

private symbols get leaked

The library exports all its non-static symbols, making ABI tracking ineffective, and risking conflicts with matching name in user projects.

Thus, please hide them, either by changing default visibility, or via a linker map.

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.