mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-05 01:10:24 +00:00
This reduces the number of compilation jobs when System.h changes from about 750 to 60. (There are still a large number of linker jobs.)
26 lines
448 B
C++
26 lines
448 B
C++
/*
|
|
* Copyright (c) 2025, the Ladybird developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/RefCounted.h>
|
|
|
|
namespace IPC {
|
|
|
|
class AutoCloseFileDescriptor : public RefCounted<AutoCloseFileDescriptor> {
|
|
public:
|
|
explicit AutoCloseFileDescriptor(int fd);
|
|
~AutoCloseFileDescriptor();
|
|
|
|
int value() const { return m_fd; }
|
|
int take_fd() { return exchange(m_fd, -1); }
|
|
|
|
private:
|
|
int m_fd { -1 };
|
|
};
|
|
|
|
}
|