Skip to content

Commit 9960137

Browse files
ryanofskyjnewbery
authored andcommitted
Add developer notes about blocking GUI code
1 parent 9a61eed commit 9960137

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

doc/developer-notes.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,19 @@ GUI
625625
should not interact with the user. That's where View classes come in. The converse also
626626
holds: try to not directly access core data structures from Views.
627627

628+
- Avoid adding slow or blocking code in the GUI thread. In particular do not
629+
add new `interface::Node` and `interface::Wallet` method calls, even if they
630+
may be fast now, in case they are changed to lock or communicate across
631+
processes in the future.
632+
633+
Prefer to offload work from the GUI thread to worker threads (see
634+
`RPCExecutor` in console code as an example) or take other steps (see
635+
https://doc.qt.io/archives/qq/qq27-responsive-guis.html) to keep the GUI
636+
responsive.
637+
638+
- *Rationale*: Blocking the GUI thread can increase latency, and lead to
639+
hangs and deadlocks.
640+
628641
Subtrees
629642
----------
630643

0 commit comments

Comments
 (0)