It's not safe to read and write memory at the same time. If it's happened it's end like a crash.
In functions 'waitForReply' and 'waitForConnect' we have two closures which run on difference threads.
And we have an unsafe operations with variable 'groupLeft'. In other hand for variable 'group' it's ok case it threads safe class.
Sadly but we don't have any atomic variables in swift to make our work easy, so we must add here 'NSLock' or just simple jump in 'timeoutTask' to 'syncQueue'.
It's not safe to read and write memory at the same time. If it's happened it's end like a crash.
In functions 'waitForReply' and 'waitForConnect' we have two closures which run on difference threads. And we have an unsafe operations with variable 'groupLeft'. In other hand for variable 'group' it's ok case it threads safe class. Sadly but we don't have any atomic variables in swift to make our work easy, so we must add here 'NSLock' or just simple jump in 'timeoutTask' to 'syncQueue'.