Hi all, just wondering can the same function of a ...
# coroutines
h
Hi all, just wondering can the same function of a singleton object be called in 2 different threads without the code being racy? Thanks in advance
r
There's nothing inherently problematic about this scenario. However, it is likely that the function does something with state on the object, which is probably a case of shared mutable state. If you're doing anything with mutable state on the Singleton object, you'd need explicit synchronization (use something like a lock or mutex) to avoid issues
h
thanks @rkechols