Open binste opened 2 months ago
If the stdlib
considers this a thread safe counter, maybe that is an easy solution?
# Helper to generate new task names
# This uses itertools.count() instead of a "+= 1" operation because the latter
# is not thread safe. See bpo-11866 for a longer explanation.
_task_name_counter = itertools.count(1).__next__
An example where I adapted this:
What is your suggestion?
Right now (version 5.4.0), Altair is mostly safe to use in a threading context. However, we could go through the whole library to make sure everything is covered and then advertise this. Features which might require adjustments/locks:
with alt.themes.enable
statement. Related: #3586Have you considered any alternative solutions?
This is not urgent and we can leave it as-is. Users and developers of other libraries can work around these limitations with locks. But it would be easier if we do it in Altair itself.