Skip to content

Swift atomic property with GCD

Atomic property implementation with GCD.

By default a DispatchQueue instantiates as a serial queue. The concept here is very simple. The count property here gets a dedicated serial queue to synchronously dispatch get and set logic. Leveraging the GCD serial queue enforces atomic behavior on the count property.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *