I was going through DispatchQueue barrier and noticed both there are two ways async(flags: .barrier) and sync(flags: .barrier)
I understood the use of the async barrier but confused with the sync barrier.
My confusion the task I want to do can be performed with this also
DispatchQueue.global().sync {
}
then what is the use of sync barrier? Why they are used? and how different in this.
DispatchQueue.global().sync(flags: .barrier) {
}