Giter Club home page Giter Club logo

asio-zig's Introduction

Asio C Wrapper - Event-loop

The wrapper provides functions for initializing the ASIO library, running it, stopping it, and posting tasks to be executed asynchronously within the event-loop. It handles the necessary conversions and memory management required to interface with ASIO from C or Zig code. Additionally, it utilizes ASIO's thread pool (asio::static_thread_pool) for multithreading support, allowing tasks to be executed concurrently on multiple threads.

How to build and run

# Zig binding test (only)
$> zig build test

# Build all C examples
$> zig build -Doptimize={option} # to debug no need `-Doptimize` flag

Note: {option} == Debug (default) | ReleaseSafe | ReleaseFast | ReleaseSmall

asio-zig's People

Contributors

kassane avatar thechampagne avatar

Stargazers

 avatar  avatar  avatar  avatar

Forkers

thechampagne

asio-zig's Issues

Darwin: `sprintf` is deprecated on CI build

But cross-compilation works:

Linux

$> zig build --summary all -Dtarget=native-macos
Build Summary: 15/15 steps succeeded
install success
├─ install hello-c success
│  └─ zig build-exe hello-c Debug native-macos success 324ms MaxRSS:58M
│     └─ zig build-lib asio_c Debug native-macos success 1s MaxRSS:166M
│        ├─ zig build-lib asio Debug native-macos cached 10ms MaxRSS:34M
│        └─ install asio/include/ cached
├─ install counter-c success
│  └─ zig build-exe counter-c Debug native-macos success 324ms MaxRSS:59M
│     └─ zig build-lib asio_c Debug native-macos cached 1s MaxRSS:34M
│        ├─ zig build-lib asio Debug native-macos (reused)
│        └─ install asio/include/ (reused)
├─ install fib-c success
│  └─ zig build-exe fib-c Debug native-macos success 324ms MaxRSS:61M
│     └─ zig build-lib asio_c Debug native-macos cached 1s MaxRSS:33M
│        ├─ zig build-lib asio Debug native-macos (reused)
│        └─ install asio/include/ (reused)
└─ install stream-c success
   └─ zig build-exe stream-c Debug native-macos success 324ms MaxRSS:58M
      └─ zig build-lib asio_c Debug native-macos cached 1s MaxRSS:33M
         ├─ zig build-lib asio Debug native-macos (reused)
         └─ install asio/include/ (reused)

Reference

Case Study: FFI Thread Safety

This case to be studied does not affect or influence the progress of the Zig project and its features.
Everything that is or will be tested has an experimental purpose.

References

Related

asio - FFI

Others

Zig test - run single-thread (only)

Run the fibonacci sample C in comparison to Zig test . A discrepancy in runtime between the zig test and fib-c is perceived.

Note: This comparison occurs if you put the same values into the fib(n) function. The zig test has smaller numbers to better pass the CI test.

Reference

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.