io/UniqueFileDescriptor: add method Release()
This commit is contained in:
@ -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());
|
||||||
|
Reference in New Issue
Block a user