Looking at implementation code of WebConnector.connect(), you can see that the method is synchronized through Promise pattern. However, the implementation seems dangerous because sequence of the synchronization are separated to many parts and those separated codes make the implementation code complicate.
To simplify the WebConnector.connect() method without damaging the synchronization, it would better to utilizing Latch class, who is a type of thread supporting component and newly added to C++20 and TSTL v2.3. Implementation code of the WebConnector.connect() method can be much simple through the Latch.wait_for() and Latch.count_down() method.
Looking at implementation code of WebConnector.connect(), you can see that the method is synchronized through
Promise
pattern. However, the implementation seems dangerous because sequence of the synchronization are separated to many parts and those separated codes make the implementation code complicate.To simplify the
WebConnector.connect()
method without damaging the synchronization, it would better to utilizing Latch class, who is a type of thread supporting component and newly added to C++20 and TSTL v2.3. Implementation code of theWebConnector.connect()
method can be much simple through theLatch.wait_for()
andLatch.count_down()
method.