private static void SubscriptionThread(object aArgs) { ThreadArgs args = (ThreadArgs)aArgs; Semaphore sem = new Semaphore(0, 1); do { CpProxyOpenhomeOrgTestBasic1 proxy = new CpProxyOpenhomeOrgTestBasic1(args.Device); proxy.SetPropertyChanged(() => sem.Release()); proxy.Subscribe(); sem.WaitOne(); proxy.Dispose(); } while (args.IncrementCount()); }