Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 51cfd6b

Browse files
committed
Add note about thread safety to FAQ.
Looks like there are more and more people running into threading issues. Add a generic FAQ entry for them, and edit the ISSUE_TEMPLATE to perhaps decrease the number of such reports.
1 parent 2660901 commit 51cfd6b

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99

1010
**Code for reproduction**
1111

12-
<!--A minimum code snippet required to reproduce the bug, also minimizing the number of dependencies required-->
12+
<!--A minimum code snippet required to reproduce the bug.
13+
Please make sure to minimize the number of dependencies required, and provide
14+
any necessary plotted data.
15+
Avoid using threads, as Matplotlib is (explicitly) not thread-safe.-->
1316

1417
```python
1518
# Paste your code here

doc/faq/howto_faq.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,18 @@ Tukey's `box plots <http://matplotlib.org/examples/pylab_examples/boxplot_demo.h
540540
`Violin plots <http://matplotlib.org/examples/statistics/violinplot_demo.html>`_ are closely related to box plots but add useful information such as the distribution of the sample data (density trace).
541541
Violin plots were added in Matplotlib 1.4.
542542

543+
.. _how-to-threads:
544+
545+
Working with threads
546+
--------------------
547+
548+
Matplotlib is not thread-safe: in fact, there are known race conditions
549+
that affect certain artists. Hence, if you work with threads, it is your
550+
responsibility to set up the proper locks to serialize access to Matplotlib
551+
artists.
552+
553+
Note that (for the case where you are working with an interactive backend) most
554+
GUI backends *require* being run from the main thread as well.
543555

544556
.. _howto-contribute:
545557

0 commit comments

Comments
 (0)