iZettle / Flow

Flow is a Swift library for working with asynchronous flows and life cycles
MIT License
231 stars 14 forks source link

[APP-153] Add thread lock to prevent race condition #90

Closed moglistree closed 5 years ago

moglistree commented 5 years ago

On xCode 11 beta the methods runExclusiveWithState and handleEventExclusiveWithState create a race condition on the property shouldCallInitial and exclusiveCount by calling beginExclusivity(). Found that this is occurs when the signal has not terminated and runExclusiveWithState gets called. My proposed solution is to add a lock before the block accessing shouldCallInitial on line 247 of Signal+Construction.swift