Mir

mir:multiplexer-keep-executor-alive

Last commit made on 2022-04-04
Get this branch:
git clone -b multiplexer-keep-executor-alive https://git.launchpad.net/mir

Branch merges

Branch information

Name:
multiplexer-keep-executor-alive
Repository:
lp:mir

Recent commits

78d8e7e... by William Wold <email address hidden>

Add executor mutex

107ace4... by "bors[bot]" <26634292+bors[bot]@users.noreply.github.com>

Merge #2372

2372: Prevent deadlocks in ObserverMultiplexer r=AlanGriffiths a=wmww

This PR adds three multiplexer tests (all of which previously deadlocked) and fixes all of them.

The core issue was that spawning an observation required locking the same mutex that remained locked while observations were being processed. The use of `recursive_mutex` mitigated that if everything was on the same thread, but if the receiving-observation thread was blocked on some other thread, which was blocked on sending an observation there was trouble.

This PR uses separate mutexes for spawning and running observations. Both are locked when an observer is unregistered, but unregister does not lock them simultaneously.

This fixes some of the deadlocks I've encountered in #2371, and assuming it's correct is an overall improvement.

Co-authored-by: William Wold <email address hidden>
Co-authored-by: Christopher James Halse Rogers <email address hidden>

35c0bf0... by "bors[bot]" <26634292+bors[bot]@users.noreply.github.com>

Merge #2373

2373: Fix typo ExplicitExectutor -> ExplicitExecutor r=RAOF a=wmww

Co-authored-by: William Wold <email address hidden>
Co-authored-by: Michał Sawicz <email address hidden>

8d8af7f... by Michał Sawicz

Merge branch 'main' into explicit-executor-fix-typo

a5212d6... by Chris Halse Rogers

Fix typo

062a7d0... by Chris Halse Rogers

Clean up ObserverMultiplexer comments and names

9d71c6e... by Chris Halse Rogers

mir::ObserverMultiplexer: Simplify WeakObserver locking.

The constraints we have are:
* The user only guarantees that the provided Executor outlives Observer, and
* Calling `unregister_observer` must block until we have guaranteed no further
  observations will be made on that observer.

Rather than smuggle the 'this observer has been unregistered' signal through
the `weak_ptr<Observer>`, have an explicit boolean protected by a specific
lock.

This means we can guarantee that the Observer hasn't been destroyed by means
of `weak_ptr<>.lock()` rather than an additional mutex.

d11d634... by "bors[bot]" <26634292+bors[bot]@users.noreply.github.com>

Merge #2369

2369: Add NonBlockingExecutor type r=RAOF a=wmww

Closes #2310

Co-authored-by: William Wold <email address hidden>

7a0f744... by William Wold <email address hidden>

Add missing include

c873103... by William Wold <email address hidden>

Test that ObserverMultiplexer doesn't deadlock when used from multiple threads