Exemplo n.º 1
0
        public void ReaderWriterAttribute_WhenInternal_Throws()
        {
            ReaderWriterWithObserverMethodClass rw = new ReaderWriterWithObserverMethodClass();
            Barrier barrier = new Barrier(2);

            rw.Write(
                100,
                () =>
            {
                Task t = new Task(
                    () =>
                {
                    lock (rw)
                    {
                        barrier.SignalAndWait();
                        rw.Write(1, () => { });
                    }
                });
                t.Start();
                barrier.SignalAndWait();
                lock (rw)
                {
                }
            });

            //rw.Read( 100 );
        }
        public void ReaderWriteWithObserverMethod_WhenInvoked_DoesNotThrow()
        {
            ReaderWriterWithObserverMethodClass rw = new ReaderWriterWithObserverMethodClass();

            rw.Write(100, () => { });

            //rw.Read( 100 );
        }
        public void ReaderWriteWithObserverMethod_WhenInvoked_DoesNotThrow()
        {
            ReaderWriterWithObserverMethodClass rw = new ReaderWriterWithObserverMethodClass();

            rw.Write( 100, () => { } );

            //rw.Read( 100 );
        }
        public void ReaderWriterAttribute_WhenInternal_Throws()
        {
            ReaderWriterWithObserverMethodClass rw = new ReaderWriterWithObserverMethodClass();
            Barrier barrier = new Barrier(2);
            rw.Write(
                100,
                () =>
                {
                    Task t = new Task(
                        () =>
                        {
                            lock (rw)
                            {
                                barrier.SignalAndWait();
                                rw.Write(1, () => { });
                            }
                        });
                    t.Start();
                    barrier.SignalAndWait();
                    lock (rw)
                    {
                    }
                });

            //rw.Read( 100 );
        }