Esempio n. 1
0
        public void DispatchBarrierSync()
        {
            TestRuntime.AssertSystemVersion(PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
            TestRuntime.AssertSystemVersion(PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);

            using (var queue = new DispatchQueue("DispatchBarrierSync")) {
                var called   = false;
                var callback = new Action(() => called = true);
                queue.DispatchBarrierSync(callback);
                Assert.IsTrue(called, "Called");

                called = false;
                using (var dg = new DispatchBlock(callback))
                    queue.DispatchBarrierSync(dg);
                Assert.IsTrue(called, "Called DispatchBlock");
            }
        }
 public void DispatchBarrierSync()
 {
     using (var queue = new DispatchQueue("DispatchBarrierSync")) {
         var called = false;
         queue.DispatchBarrierSync(() =>
         {
             called = true;
         });
         Assert.IsTrue(called, "Called");
     }
 }