1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 03:08:13 +00:00

SharedBuffer: Split the creation and share steps

This allows us to seal a buffer *before* anyone else has access to it
(well, ok, the creating process still does, but you can't win them all).

It also means that a SharedBuffer can be shared with multiple clients:
all you need is to have access to it to share it on again.
This commit is contained in:
Robin Burchell 2019-07-18 09:52:22 +02:00 committed by Andreas Kling
parent f60d7e5d1f
commit b907608e46
12 changed files with 58 additions and 22 deletions

View file

@ -5,10 +5,11 @@
class SharedBuffer : public RefCounted<SharedBuffer> {
public:
static RefPtr<SharedBuffer> create(pid_t peer, int);
static RefPtr<SharedBuffer> create_with_size(int);
static RefPtr<SharedBuffer> create_from_shared_buffer_id(int);
~SharedBuffer();
bool share_with(pid_t);
int shared_buffer_id() const { return m_shared_buffer_id; }
void seal();
int size() const { return m_size; }