Re:Minimalist C Libraries
by xtrapolate on Sunday June 10, 2018 @02:46PM
(#17279557)
Now, you can happily use:
What else do you need? You seem very disturbed by the use of the word "allocator" here, feel free to rename to whatever works for you.
[ Parent
| on HN ]
> What else do you need?
A guarantee that this "allocator function" is only ever called once.
Re:Minimalist C Libraries
by xtrapolate on Sunday June 10, 2018 @03:06PM
(#17279669)
Are you seriously suggesting this is an issue? That's entirely up to you to solve in your custom allocator.
Use whatever mechanism is available to you. Use a global condition variable, check it atomically every time you're entering your custom allocator, increment after a successful allocation. I don't know your system's constraints, nor should I...
I'm not talking about concurrency. I'm talking about needing to know exactly how many bytes are being allocated ahead of time, because I've got 192k of ram, and 112k of them are spoken for by I/O buffers.
If I pass in an allocator that returns the statically allocated buffer, then the second call to it must abort loudly.