This PR is branched off of subscription at f80411. We should merge #38 before this and then rebase this branch onto master.
This adds locking to provide thread safety. I use ReentrantLock as intrinsic locking syntax in Kotlin is deprecated.
Testing thread safety with unit tests has proven to be quite hard and computationally intensive. The resulting tests may or may not reveal actual concurrency problems because the tests tend to be flaky. I'd keep the existing ones as they add some confidence, but in the future I'd consider manual review a good alternative.
Also, I'd like to avoid locking synchronization in future and use queues, ExecutorServices, actors or whatever else whenever possible.
This PR is branched off of
subscription
at f80411. We should merge #38 before this and then rebase this branch onto master.This adds locking to provide thread safety. I use
ReentrantLock
as intrinsic locking syntax in Kotlin is deprecated.Testing thread safety with unit tests has proven to be quite hard and computationally intensive. The resulting tests may or may not reveal actual concurrency problems because the tests tend to be flaky. I'd keep the existing ones as they add some confidence, but in the future I'd consider manual review a good alternative. Also, I'd like to avoid locking synchronization in future and use queues, ExecutorServices, actors or whatever else whenever possible.
closes #29