@@ -7588,17 +7588,17 @@ Consider:
7588
7588
7589
7589
void send(X* x, cstring_span destination)
7590
7590
{
7591
- auto port = OpenPort (destination);
7591
+ auto port = open_port (destination);
7592
7592
my_mutex.lock();
7593
7593
// ...
7594
- Send (port, x);
7594
+ send (port, x);
7595
7595
// ...
7596
7596
my_mutex.unlock();
7597
- ClosePort (port);
7597
+ close_port (port);
7598
7598
delete x;
7599
7599
}
7600
7600
7601
- In this code, you have to remember to `unlock`, `ClosePort `, and `delete` on all paths, and do each exactly once.
7601
+ In this code, you have to remember to `unlock`, `close_port `, and `delete` on all paths, and do each exactly once.
7602
7602
Further, if any of the code marked `...` throws an exception, then `x` is leaked and `my_mutex` remains locked.
7603
7603
7604
7604
##### Example
@@ -7610,7 +7610,7 @@ Consider:
7610
7610
Port port{destination}; // port owns the PortHandle
7611
7611
lock_guard<mutex> guard{my_mutex}; // guard owns the lock
7612
7612
// ...
7613
- Send (port, x);
7613
+ send (port, x);
7614
7614
// ...
7615
7615
} // automatically unlocks my_mutex and deletes the pointer in x
7616
7616
@@ -7621,8 +7621,8 @@ What is `Port`? A handy wrapper that encapsulates the resource:
7621
7621
class Port {
7622
7622
PortHandle port;
7623
7623
public:
7624
- Port(cstring_span destination) : port{OpenPort (destination)} { }
7625
- ~Port() { ClosePort (port); }
7624
+ Port(cstring_span destination) : port{open_port (destination)} { }
7625
+ ~Port() { close_port (port); }
7626
7626
operator PortHandle() { return port; }
7627
7627
7628
7628
// port handles can't usually be cloned, so disable copying and assignment if necessary
0 commit comments