summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorkleines Filmröllchen <filmroellchen@serenityos.org>2022-01-23 23:31:51 +0100
committerLinus Groh <mail@linusgroh.de>2022-04-21 13:55:00 +0200
commit6b13436ef64b8ae91f71b3fed2e8555f733d7998 (patch)
tree2473662c9b2c8962d1bf926c03106299ea336e0f /AK
parentb0a2572577af0132bd3a9408ea05219fa093a79b (diff)
downloadserenity-6b13436ef64b8ae91f71b3fed2e8555f733d7998.zip
LibCore: Introduce SharedSingleProducerCircularQueue
This new class with an admittedly long OOP-y name provides a circular queue in shared memory. The queue is a lock-free synchronous queue implemented with atomics, and its implementation is significantly simplified by only accounting for one producer (and multiple consumers). It is intended to be used as a producer-consumer communication datastructure across processes. The original motivation behind this class is efficient short-period transfer of audio data in userspace. This class includes formal proofs of several correctness properties of the main queue operations `enqueue` and `dequeue`. These proofs are not 100% complete in their existing form as the invariants they depend on are "handwaved". This seems fine to me right now, as any proof is better than no proof :^). Anyways, the proofs should build confidence that the implemented algorithms, which are only roughly based on existing work, operate correctly in even the worst-case concurrency scenarios.
Diffstat (limited to 'AK')
-rw-r--r--AK/Debug.h.in4
1 files changed, 4 insertions, 0 deletions
diff --git a/AK/Debug.h.in b/AK/Debug.h.in
index a4693ffa6c..2861c2e210 100644
--- a/AK/Debug.h.in
+++ b/AK/Debug.h.in
@@ -386,6 +386,10 @@
#cmakedefine01 SH_LANGUAGE_SERVER_DEBUG
#endif
+#ifndef SHARED_QUEUE_DEBUG
+#cmakedefine01 SHARED_QUEUE_DEBUG
+#endif
+
#ifndef SHELL_JOB_DEBUG
#cmakedefine01 SHELL_JOB_DEBUG
#endif