Thread safety in Swift Thread safety in Swift ios ios

Thread safety in Swift


I think Alexander W has the right idea, but I would advise synchronizing on self as a general rule. Perhaps the suggestion I posted here may help:


You can implement your Getters Setters on thread-safe properties with use of dispatch_semaphore_t, NSLock or pthread_mutex_t, or similiar stuff.

Currently, there are no attributes, which define some behaviour, like atomic/nonatomic quialifers of Obj-C