public void AddSubscription(ISubscription subscription)
{
if (subscription == null)
{
throw new ArgumentNullException("subscription");
}
try
{
SubscriptionLock.EnterWriteLock();
MarkUsed();
Subscriptions.Add(subscription);
// Created -> HasSubscriptions
Interlocked.CompareExchange(ref State,
TopicState.HasSubscriptions,
TopicState.NoSubscriptions);
}
finally
{
SubscriptionLock.ExitWriteLock();
}
}