Task: Demonstrate and Fix Thread-Safety Issues with Python Instance Variables
Task: Demonstrate and Fix Thread-Safety Issues with Python Instance Variables: a task in Terminal-Lego-15k (Harbor dataset). Python instance variables are not thread-safe when compound operations (like read-modify-write) are performed on them from multiple threads. Even though CPython has the GIL…
The task
Python instance variables are **not** thread-safe when compound operations (like read-modify-write) are performed on them from multiple threads. Even though CPython has the GIL (Global Interpreter Lock), operations like `self.Counter = self.Counter + 1` are not atomic — they involve reading the value, incrementing…
Part of PrimeIntellect/Terminal-Lego-15k.