This repository has been archived by the owner on Oct 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CloseableHandle::closeWhenDisposed() (#159)
Summary: If not used and `close()` is not called, handles will be closed at some undefined later time, e.g. end of request or when garabage collected. No current implementation is refcount-based. Pull Request resolved: #159 Reviewed By: DavidSnider Differential Revision: D22418834 Pulled By: fredemmott fbshipit-source-id: 0bcee26d7d3357cafefd796944cf0172448361b6
- Loading branch information
1 parent
f131390
commit 35a7464
Showing
7 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,6 @@ | |
"hhvm/hsl": "^4.15" | ||
}, | ||
"provide": { | ||
"hhvm/hsl-io": "0.2.0" | ||
"hhvm/hsl-io": "0.2.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?hh | ||
/* | ||
* Copyright (c) 2004-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
namespace HH\Lib\_Private\_IO; | ||
|
||
use namespace HH\Lib\IO; | ||
|
||
final class CloseWhenDisposed implements \IDisposable { | ||
public function __construct( | ||
private IO\CloseableHandle $handle, | ||
) { | ||
} | ||
|
||
public function __dispose(): void { | ||
$this->handle->close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters