diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-05-25 09:42:48 +0300 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2017-05-27 09:25:03 +0300 |
commit | b608d85db78cb672da76cb4531438ba32843c6fb (patch) | |
tree | 79e6a058fc6f3f1420fe254c1b409dedcb8d5daa /src | |
parent | f0d0e7423b610782fdbed576bc2a442b82c8e1f8 (diff) | |
download | qtlocation-mapboxgl-b608d85db78cb672da76cb4531438ba32843c6fb.tar.gz |
[core] allow self closing mailbox/actor
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/actor/mailbox.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mbgl/actor/mailbox.cpp b/src/mbgl/actor/mailbox.cpp index 947f6f9028..373c24275f 100644 --- a/src/mbgl/actor/mailbox.cpp +++ b/src/mbgl/actor/mailbox.cpp @@ -15,7 +15,8 @@ void Mailbox::close() { // must not block send(). Of the two, the receiving mutex must be acquired first, because that is // the order that an actor will obtain them when it self-sends a message, and consistent lock // acquisition order prevents deadlocks. - std::lock_guard<std::mutex> receivingLock(receivingMutex); + // The receiving mutex is recursive to allow a mailbox (and thus the actor) to close itself. + std::lock_guard<std::recursive_mutex> receivingLock(receivingMutex); std::lock_guard<std::mutex> pushingLock(pushingMutex); closed = true; @@ -37,7 +38,7 @@ void Mailbox::push(std::unique_ptr<Message> message) { } void Mailbox::receive() { - std::lock_guard<std::mutex> receivingLock(receivingMutex); + std::lock_guard<std::recursive_mutex> receivingLock(receivingMutex); if (closed) { return; |