Looking for more details on thread safety of arrays and dictionaries

Godot Version

v4.2.2.stable.official [15073afe3]


The Thread-safe APIs documentation (Thread-safe APIs — Godot Engine (stable) documentation in English), in addition to not being updated for Godot 4, has only very scant information regarding the thread safety of arrays and dictionaries. To quote:

In GDScript, reading and writing elements from multiple threads is OK, but anything that changes the container size (resizing, adding or removing elements) requires locking a mutex.

Given that I have a thread that will add or remove elements, does that mean I have to lock that mutex everywhere and every time I index an element in the array or dictionary?

Or do I just have to ensure that no two threads will simultaneously add or remove elements?

Or has this changed completely in Godot 4?