io/UniqueFileDescriptor: add method Release()
This commit is contained in:
parent
48afb68f3a
commit
1c079e554b
|
@ -64,6 +64,14 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release ownership and return the descriptor as an unmanaged
|
||||||
|
* #FileDescriptor instance.
|
||||||
|
*/
|
||||||
|
FileDescriptor Release() noexcept {
|
||||||
|
return std::exchange(*(FileDescriptor *)this, Undefined());
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Set(int _fd) noexcept {
|
void Set(int _fd) noexcept {
|
||||||
assert(!IsDefined());
|
assert(!IsDefined());
|
||||||
|
|
Loading…
Reference in New Issue