Commit b26ef8ac authored by Aaryaman Sagar's avatar Aaryaman Sagar Committed by Facebook Github Bot 3

Removing noexcept specifications in constructors for Synchronized that call...

Removing noexcept specifications in constructors for Synchronized that call contextualLock() and contextualRLock()

Summary:
Most mutex lock() functions do not have a noexcept guarantee, saying that the
constructor for Synchronized based on whether the underlying constructor for
the type stored is not enough.  Although this will *rarely* cause bugs, it
probably can be fixed

Reviewed By: simpkins

Differential Revision: D3682974

fbshipit-source-id: ec0bb701d0af41ffc79128fe8db7935a5f19bc70
parent 6b554b1e
......@@ -335,15 +335,24 @@ struct Synchronized : public SynchronizedBase<
* Copy constructor copies the data (with locking the source and
* all) but does NOT copy the mutex. Doing so would result in
* deadlocks.
*
* Note that the copy constructor may throw because it acquires a lock in
* the contextualRLock() method
*/
Synchronized(const Synchronized& rhs) noexcept(nxCopyCtor)
Synchronized(const Synchronized& rhs) /* may throw */
: Synchronized(rhs, rhs.contextualRLock()) {}
/**
* Move constructor moves the data (with locking the source and all)
* but does not move the mutex.
*
* Note that the move constructor may throw because it acquires a lock.
* Since the move constructor is not declared noexcept, when objects of this
* class are used as elements in a vector or a similar container. The
* elements might not be moved around when resizing. They might be copied
* instead. You have been warned.
*/
Synchronized(Synchronized&& rhs) noexcept(nxMoveCtor)
Synchronized(Synchronized&& rhs) /* may throw */
: Synchronized(std::move(rhs), rhs.contextualLock()) {}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment