Lazy property is initialized twice
up vote
0
down vote
favorite
As we all know lazy property is not thread safe . my evaluation part is like this. if someclass isInitialized { return someclass instance } else{ initialize someclass return someclass instance } The problem is If thread 1 sees that someclass is not initialised it will then try to do so. If thread 2 sees that someclass is not initialised before thread 1 gets to do so, then it too will try to initialise it too. so it is initialized twice can we overcome this with lazy property?
swift lazy-evaluation lazy-initialization
share | improve this question
asked Nov 21 at 7:35
Naveen...