As

Async tasks in 350 lines of C

Hacker News

Async tasks in 350 lines of C

Tasks are a primitive for asynchronous programming and an alternative to working with threads directly. Instead of creating a thread, performing work, then waiting on it using synchronization primitives, you only define a unit of work and let a scheduler decide when and where to execute it. The threads that the scheduler uses are created once and reused for many tasks throughout the program's lifetime. In most cases, creating and executing a task requires not even a single syscall and is a significantly faster operation than creating a thread, resulting in lower latency. Furthermore, tasks from different subsystems can be automatically interleaved by the scheduler, which is difficult to achieve manually with threads without communication between the subsystems. The library is written in standard C11 and only depends on the C POSIX library. It is designed to be easy to integrate into a project by just copying the header and simple enough to be understood in an afternoon.

Share card

Actual performance

146points
52comments
Made the leaderboard

Launch Intel predictions

Analyze your own launch →
Product HuntOn track for Day 1 leaderboard · Strong signals: single, tasks, using · Missing: mac, agents, macos
66%66% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
Hacker NewsStrong engagement from HN community · Strong signals: ide, io · Missing: https docs, excited, just released
65%65% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
Indie HackersFits the IH revenue-focused audience · Strong signals: created · Missing: supports, reddit linkedin, podcasting
56%56% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Missing: plus, platform, intuitive
50%50% predicted probability of success on AppSumo, based on ML models trained on real launch data.
TrustMRRLess likely to generate early MRR · Missing: mobile apps, ios, personal
48%48% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
13%13% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Sp
Spinning Cube in 45 lines, 45 Chars Each52%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Spinning Cube in 45 lines, 45 Chars Each

Hacker News1
Fl
Flappy Bird in 128 Lines of CoffeeScript43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Flappy Bird in 128 Lines of CoffeeScript

Hacker News6
Ow
Own MobX in 65 lines of code51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Own MobX in 65 lines of code

Hacker News12
Im
Implement MFA in two lines of code58%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Implement MFA in two lines of code

Hacker News8
Wa
Wavelet video codec in less than 5000 lines of C59%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Wavelet video codec in less than 5000 lines of C

Hacker News4
3
3 lines to hook into ethereum data streams65%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

3 lines to hook into ethereum data streams

Hacker News4
Up
Upgrade Charm Crush with search in 9 lines52%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Upgrade Charm Crush with search in 9 lines

Hacker News1
Ma
MathGPT for numerical modelling software – lines combined method55%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

MathGPT for numerical modelling software – lines combined method

Hacker News1
Hi
HingeGPT – Generate mediocre Hinge opening lines53%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

HingeGPT – Generate mediocre Hinge opening lines

Hacker News3
Li
Lines, the free London Underground app49%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Lines, the free London Underground app

Hacker News2