[#BloombergLP-bdls-FileDescriptorGuard-2constructor]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdls.adoc[bdls]::xref:BloombergLP/bdls/FileDescriptorGuard.adoc[FileDescriptorGuard]::FileDescriptorGuard
:relfileprefix: ../../../
:mrdocs:

Create a guard that manages the specified `descriptor`&period;

== Synopsis

Declared in `&lt;bdls&lowbar;filedescriptorguard&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
FileDescriptorGuard(xref:BloombergLP/bdls/FilesystemUtil/FileDescriptor.adoc[FilesystemUtil::FileDescriptor] descriptor);
----

== Description

Create a guard object that will manage the specified `descriptor`, closing it upon destruction (unless either `release` or `closeAndRelease` has been called)&period; It is permissible for `descriptor` to be `FilesystemUtil&colon;&colon;k&lowbar;INVALID&lowbar;FD`, in which case the guard created will not manage anything&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *descriptor*
| file descriptor to manage&semi; may be `k&lowbar;INVALID&lowbar;FD`
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
