mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:07:44 +00:00
LibIPC: Allow transporting a SharedCircularQueue over IPC
This commit is contained in:
parent
6b13436ef6
commit
fc7d231b00
2 changed files with 23 additions and 0 deletions
|
@ -11,7 +11,10 @@
|
|||
#include <AK/NumericLimits.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Try.h>
|
||||
#include <LibCore/SharedCircularQueue.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibIPC/File.h>
|
||||
#include <LibIPC/Forward.h>
|
||||
#include <LibIPC/Message.h>
|
||||
|
||||
|
@ -117,6 +120,18 @@ public:
|
|||
return {};
|
||||
}
|
||||
|
||||
template<typename T, size_t Size>
|
||||
ErrorOr<void> decode(Core::SharedSingleProducerCircularQueue<T, Size>& queue)
|
||||
{
|
||||
// FIXME: We don't support decoding into valid queues.
|
||||
VERIFY(!queue.is_valid());
|
||||
|
||||
IPC::File anon_file;
|
||||
TRY(decode(anon_file));
|
||||
queue = TRY((Core::SharedSingleProducerCircularQueue<T, Size>::try_create(anon_file.take_fd())));
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
ErrorOr<void> decode(Optional<T>& optional)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue