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