Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hnsl/librcd
A library for Rapid {C|Concurrency|Correct} Development
https://github.com/hnsl/librcd
Last synced: 16 days ago
JSON representation
A library for Rapid {C|Concurrency|Correct} Development
- Host: GitHub
- URL: https://github.com/hnsl/librcd
- Owner: hnsl
- License: other
- Created: 2014-08-20T20:17:19.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-03T22:30:39.000Z (about 9 years ago)
- Last Synced: 2024-04-10T05:28:10.414Z (7 months ago)
- Language: C
- Size: 2.78 MB
- Stars: 34
- Watchers: 9
- Forks: 4
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# librcd
*A library for Rapid {C|Concurrency|Correct} Development*https://blog.jumpstarter.io/announcing-librcd-concurrency-segmented-stacks-c
Librcd is a new C standard library and POSIX replacement for x86_64 Linux, used for most things at [Jumpstarter](https://jumpstarter.io/). It comes with some custom syntax, and makes threading, strings, error handling, memory management and IO easy. Here's a small example:
```c
#include "rcd.h"
#pragma librcdjoin_locked(int) switcheroo(int next, join_server_params, int* current) {
int prev = *current;
DBG("swapping ", prev, " <-> ", next);
*current = next;
return prev;
}fiber_main worker(fiber_main_attr, int value, rcd_fid_t fid) {
for (;;) {
rio_wait(prng_rand() % RIO_NS_SEC);
value = switcheroo(value, fid);
}
}void rcd_main(list(fstr_t)* main_args, list(fstr_t)* main_env) {
for (int i = 1; i <= 5; i++) {
fmitosis {
spawn_fiber(worker("", i, rcd_self));
}
}
int free_value = 0;
auto_accept_join(switcheroo, join_server_params, &free_value);
}
```For more code examples, covering e.g. strings, memory management and exceptions, see [the announce blog post](https://blog.jumpstarter.io/announcing-librcd-concurrency-segmented-stacks-c). You can also check out the source code of librcd (it's rather readable), or [wsr](https://github.com/jumpstarter-io/wsr), a basic web server library written on top of librcd.
Librcd is **highly non-portable**, and meant to be used mainly for server development, in a controlled environment. Only x86_64 Linux is supported, and this is [unlikely to change](https://github.com/jumpstarter-io/librcd/issues/2). Furthermore, due to license conflicts, binaries compiled with librcd [cannot currently be legally distributed](https://github.com/jumpstarter-io/librcd/issues/1).
Some documentation [can be found in the wiki](https://github.com/jumpstarter-io/librcd/wiki); see in particular the [Installing](https://github.com/jumpstarter-io/librcd/wiki/Installing) page. The mentioned blog post also provides a lot of motivation and in-depth descriptions of most library features.