- Edited
I have a variable that tracks the progress of two coroutines.
For example:
var array = []
func add_1():
await func_that_takes_10_seconds_to_complete()
array.append(1)
func add_2():
await func_that_takes_10_seconds_to_complete()
array.append(2)
add_1()
add_2()
I know that if I called these functions from two different Threads, then I would need to protect my array
with a Mutex.
Do I also need a Mutex in this situation, where two coroutines are running at the same time? Or is there a guarantee that they won't run in parallel and mess up my array
?