Skip to content

Commit ee3f7dd

Browse files
committed
THREADING.md: Add note re PR11604.
1 parent 179f886 commit ee3f7dd

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

v3/docs/THREADING.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,11 @@ thread safe classes offered here do not yet support Unix.
191191

192192
Globals are implemented as a `dict`. Adding or deleting an entry is unsafe in
193193
the main program if there is a context which accesses global data and does not
194-
use the GIL. This means hard ISR's and code running on another core. Given that
195-
shared global data is widely used, the following guidelines should be followed.
196-
([This pr](https://github.com/micropython/micropython/pull/11604) aims to fix
197-
this issue).
194+
use the GIL. This means hard ISR's and code running on another core. The
195+
following guidelines should be followed.
196+
197+
Note that [PR 11604](https://github.com/micropython/micropython/pull/11604)
198+
aims to fix this issue. Once merged, the use of globals will be threadsafe.
198199

199200
All globals should be declared in the main program before an ISR starts to run,
200201
and before code on another core is started. It is valid to insert placeholder
@@ -215,10 +216,10 @@ def foo():
215216
global bar
216217
bar = 42
217218
```
218-
Once again the hazard is avoided by, in global scope, populating `bar` prior
219-
with a placeholder before allowing other contexts to run.
219+
The hazard is avoided by instantiating `bar` in global scope (populated with a
220+
placeholder) before allowing other contexts to run.
220221

221-
If globals must be created and destroyed dynamically, a lock must be used.
222+
If globals must be created or destroyed dynamically, a lock must be used.
222223

223224
## 1.6 Debugging
224225

0 commit comments

Comments
 (0)