diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2018-04-02 12:16:35 -0400 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2018-04-04 16:52:41 -0400 |
commit | 996013769711bd507cdcd6dde88cbd59fcd4fbad (patch) | |
tree | bf83bb5660f492c91f5a2291a9e9858a080b2940 | |
parent | 9a61eed1fcc16ddcedc315045f470e1958b0760b (diff) |
Add developer notes about blocking GUI code
-rw-r--r-- | doc/developer-notes.md | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/developer-notes.md b/doc/developer-notes.md index 540f2e8b84..b00cceb987 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -625,6 +625,19 @@ GUI should not interact with the user. That's where View classes come in. The converse also holds: try to not directly access core data structures from Views. +- Avoid adding slow or blocking code in the GUI thread. In particular do not + add new `interface::Node` and `interface::Wallet` method calls, even if they + may be fast now, in case they are changed to lock or communicate across + processes in the future. + + Prefer to offload work from the GUI thread to worker threads (see + `RPCExecutor` in console code as an example) or take other steps (see + https://doc.qt.io/archives/qq/qq27-responsive-guis.html) to keep the GUI + responsive. + + - *Rationale*: Blocking the GUI thread can increase latency, and lead to + hangs and deadlocks. + Subtrees ---------- |