summaryrefslogtreecommitdiff
path: root/AK/NoAllocationGuard.h
AgeCommit message (Collapse)Author
2023-01-07AK: Restrict include of LibC headerBen Wiederhake
2022-11-26AK: Make it possible to not `using` AK classes into the global namespaceAndreas Kling
This patch adds the `USING_AK_GLOBALLY` macro which is enabled by default, but can be overridden by build flags. This is a step towards integrating Jakt and AK types.
2022-10-10Everywhere: Replace uses of __serenity__ with AK_OS_SERENITYAndrew Kaster
Now that we have OS macros for essentially every supported OS, let's try to use them everywhere.
2022-01-14Everywhere: Use my new serenityos.org e-mail :^)kleines Filmröllchen
2022-01-13Tests: Test FixedArray completelykleines Filmröllchen
Except for tangential accessors such as data(), there is no more feature of FixedArray that is untested after this large expansion of its test cases. These tests, with the help of the new NoAllocationGuard, also test the allocation contract that was fixated in the last commit. Hopefully this builds confidence in future Kernel uses of FixedArray as well as its establishment in the real-time parts of the audio subsystem. I'm excited :^)
2022-01-13AK: Disable NoAllocationGuard on Lagomkleines Filmröllchen
Because we don't have our LibC on Lagom, the allocation guard global flag doesn't exist and NoAllocationGuard fails to build on Lagom. Whoops. For now, just disable NoAllocationGuard's functionality here.
2022-01-11AK+LibC+LibPthread: Introduce NoAllocationGuardkleines Filmröllchen
NoAllocationGuard is an RAII stack guard that prevents allocations while it exists. This is done through a thread-local global flag which causes malloc to crash on a VERIFY if it is false. The guard allows for recursion. The intended use case for this class is in real-time audio code. In such code, allocations are really bad, and this is an easy way of dynamically enforcing the no-allocations rule while giving the user good feedback if it is violated. Before real-time audio code is executed, e.g. in LibDSP, a NoAllocationGuard is instantiated. This is not done with this commit, as currently some code in LibDSP may still incorrectly allocate in real- time situations. Other use cases for the Kernel have also been added, so this commit builds on the previous to add the support both in Userland and in the Kernel.