Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eerimoq/async
🔀 Asynchronous framework in C.
https://github.com/eerimoq/async
bare-metal c embedded linux rtos
Last synced: 2 months ago
JSON representation
🔀 Asynchronous framework in C.
- Host: GitHub
- URL: https://github.com/eerimoq/async
- Owner: eerimoq
- License: mit
- Created: 2019-11-19T07:05:38.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-11-07T07:03:37.000Z (about 2 years ago)
- Last Synced: 2024-08-04T04:03:05.269Z (5 months ago)
- Topics: bare-metal, c, embedded, linux, rtos
- Language: C
- Homepage:
- Size: 1.28 MB
- Stars: 25
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
- awesome-embedded-software - async - Asynchronous framework in C for systems where low memory usage is important. (OS / Event based scheduler)
README
|buildstatus|_
|codecov|_
|nala|_🔀 Async
=======Asynchronous framework in C for systems where low memory usage is
important.Features
========- Delayed (asynchronous) function calls.
- Timers.
- An MQTT client (only QoS 0 is supported).
- A simple shell.
- TCP client and server.
- Secure communication with SSL/TLS.
Project homepage: https://github.com/eerimoq/async
Releases: https://github.com/eerimoq/async/releases
Examples
========The hello world example, printing 'Hello world!' periodically.
.. code-block:: c
#include
#include "async.h"static void on_timeout()
{
printf("Hello world!\n");
}int main()
{
struct async_t async;
struct async_timer_t timer;async_init(&async);
async_set_runtime(&async, async_runtime_create());
async_timer_init(&timer, on_timeout, NULL, 0, 1000, &async);
async_timer_start(&timer);
async_run_forever(&async);return (0);
}There are more examples in the `examples folder`_.
Runtimes
========A runtime implements zero or more of the following features:
- Timer handling.
- Networking (TCP).
- Call functions in the worker pool.
- Call functions from any thread.
Default
-------The default runtime does not implement any runtime features. It's
designed for minimal dependencies and easy integration in any
application.Typical usage:
.. code-block:: c
async_init(&async);
...
while (true) {
epoll_wait(...);
...
if (timeout) {
async_tick(&async);
}
async_process(&async);
}Native
------The native runtime implements all runtime features.
Typical usage:
.. code-block:: c
async_init(&async);
async_set_runtime(&async, async_runtime_create());
...
async_run_forever(&async);Design
======Input
-----First ``*_input(self_p)`` is called to signal that data is
available. Then read data with ``*_read(self_p, buf_p, size)``.Output
------Write data with ``*_write(self_p, buf_p, size)``.
Unit testing
============Source the development environment setup script.
.. code-block:: shell
$ source setup.sh
Execute all unit tests.
.. code-block:: shell
$ make -s -j4 test
...Execute tests matching given pattern.
.. code-block:: shell
$ make -s -j4 ARGS=core_timer test
..... |buildstatus| image:: https://travis-ci.org/eerimoq/async.svg?branch=master
.. _buildstatus: https://travis-ci.org/eerimoq/async.. |codecov| image:: https://codecov.io/gh/eerimoq/async/branch/master/graph/badge.svg
.. _codecov: https://codecov.io/gh/eerimoq/async.. |nala| image:: https://img.shields.io/badge/nala-test-blue.svg
.. _nala: https://github.com/eerimoq/nala.. _examples folder: https://github.com/eerimoq/async/tree/master/examples