understandingCombine icon indicating copy to clipboard operation
understandingCombine copied to clipboard

Possible race condition in subjects example

Open moreindirection opened this issue 4 years ago • 0 comments

Excellent book!

Just wanted to note something: the increment operation highlighted below is vulnerable to a race condition. In the example in the book, it's true that only one piece of code does the increment and it's always on the main thread, so it's safe, but the danger here should still be noted in a comment or in the text.

https://github.com/mattneub/understandingCombine/blob/236c4af76689d71d985cd00bf64a1b726101ca35/publishers/publishersSubject.txt#L24

moreindirection avatar Apr 24 '20 19:04 moreindirection