mattgallagher / CwlSignal

A Swift framework for reactive programming.
ISC License
303 stars 33 forks source link

Deadlock #28

Closed cosmer closed 6 years ago

cosmer commented 6 years ago

The following code deadlocks when signal2 is created:

let context = Exec.asyncQueue()

let signal1 = Signal.from(sequence: [1])
    .continuous()

let signal2 = signal1
    .map(context: context) { 2*$0 }
    .continuous()

queue.sync is called when already executing on queue.

I believe this was introduced in the 2.0 refactoring.

mattgallagher commented 6 years ago

Oops, that's a pretty simple mistake to get through the unit tests. I've immediately fixed the problem and added it as a test case to ensure it doesn't happen in future.

See commit c50c52638f47fd5515e5d74d2466a0e7386659d4

cosmer commented 6 years ago

That's great. Thanks.