Readit News logoReadit News
rkaehn commented on Making my dumb A/C smart with Elixir and Nerves   milanvit.net/post/making-... · Posted by u/Cellane
rkaehn · a year ago
Regarding the footnote about the temperature encoding: it seems to be Gray code
rkaehn commented on Show HN: Async tasks in 350 lines of C   github.com/rkaehn/cr_task... · Posted by u/rkaehn
gonzus · a year ago
How do you release all the resources created? I could not find any instances of `free()` in the code (and there are two calls to `malloc()`). Are you supposed to call `free()` yourself directly on the executor / task pointers? If so, I would suggest exposing a documented API to dispose of resources.
rkaehn · a year ago
The tasks themselves come from a pool and are reused automatically, so no call to `free` is needed there. As for the executor, destroying it is a bit involved, because you need to wait for the currently executed task to finish before joining the threads and releasing the resources. It is a feature I do want to work on in the future though.
rkaehn commented on Show HN: Async tasks in 350 lines of C   github.com/rkaehn/cr_task... · Posted by u/rkaehn
dc-programmer · a year ago
What do lines 7-21 do?
rkaehn · a year ago
The library is an "stb-style" header-only library, so the header has two modes: when you define CR_TASK_IMPL, it includes the implementation (starting from line 20), otherwise it just includes declarations (the first 19 lines). The implementation should only be included in one translation unit, but the declarations can be included in multiple units.

u/rkaehn

KarmaCake day39January 13, 2024View Original