mirror of
https://github.com/NixOS/nix
synced 2025-07-01 00:07:58 +02:00
Extend internal API docs, part 2
Picking up from #8111. Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
This commit is contained in:
parent
8ae9d66940
commit
abd5e7dec0
32 changed files with 640 additions and 359 deletions
|
@ -7,22 +7,22 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
/* This template class ensures synchronized access to a value of type
|
||||
T. It is used as follows:
|
||||
|
||||
struct Data { int x; ... };
|
||||
|
||||
Sync<Data> data;
|
||||
|
||||
{
|
||||
auto data_(data.lock());
|
||||
data_->x = 123;
|
||||
}
|
||||
|
||||
Here, "data" is automatically unlocked when "data_" goes out of
|
||||
scope.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This template class ensures synchronized access to a value of type
|
||||
* T. It is used as follows:
|
||||
*
|
||||
* struct Data { int x; ... };
|
||||
*
|
||||
* Sync<Data> data;
|
||||
*
|
||||
* {
|
||||
* auto data_(data.lock());
|
||||
* data_->x = 123;
|
||||
* }
|
||||
*
|
||||
* Here, "data" is automatically unlocked when "data_" goes out of
|
||||
* scope.
|
||||
*/
|
||||
template<class T, class M = std::mutex>
|
||||
class Sync
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue