1e22817dfb
This smart pointer is designed to help with putting some explicitness and safety around the case where someone will use their own object that implements the BDataIO interface to store the body of a network request. By default, BDataIO objects do not require or enforce thread safety. Since accessing these unsynchronized objects between two threads is undefined behavior, it should be explicitly discouraged. The BExclusiveBorrow/BBorrow smart pointer helper helps solve that by enforcing the limitations on using an unsynchronized object in two threads. When used correctly, there is a runtime check on incorrect use by the developer. This should help write better code. The design is based on shared_ptr, including having an admin block akin the control block, that manages the internal object. This type-erased admin block has the advantage that it allows the owner to have a different type than the borrower. It also handles cases where the lifetime of the borrower is longer than the owner: the borrower can continue to use the object until they want to return it, after which it will be cleaned up. This will make it possible to do some fire and forget pattern in the network services kit, where someone may just wants to create a file and borrow it to the network request, and care about further processing the file in the future. Change-Id: Ie9b7e7472c868b60f663b4db4fa449d421e447eb |
||
---|---|---|
.. | ||
ErrorsExt.dox | ||
ExclusiveBorrow.dox | ||
HttpFields.dox | ||
HttpRequest.dox | ||
HttpResult.dox | ||
HttpSession.dox | ||
HttpTime.dox | ||
NetServicesDefs.dox |