+2 votes

Operations on single variables aren't atomic or whatever in Godot, right?

Godot version 3.2.stable
related to an answer for: Is it possible to kill a thread?
in Engine by (14 points)

1 Answer

0 votes

The rule of thumb is that if a Thread accesses a variable or uses a function that accesses a variable in the GlobalScope (meaning it can be changed by other Threads) then you use mutex_locks to synchronize that data.

In your case it would not be necessary since its only being used in that Thread alone.
That being said if you plan to use multiple Threads then you also need to have multiple booleans, one for each defined Thread

by (5,202 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.