Bend.RegionExposedFiles.readRegionAddrNonExcl C# (CSharp) Метод

readRegionAddrNonExcl() публичный Метод

public readRegionAddrNonExcl ( long region_addr ) : IRegion
region_addr long
Результат IRegion
        public IRegion readRegionAddrNonExcl(long region_addr)
        {
            return INTERNAL_readRegionAddrNonExcl(region_addr);
        }

Usage Example

        public void T02_Region_References()
        {
            RegionExposedFiles rm = new RegionExposedFiles(InitMode.NEW_REGION,
                    "C:\\BENDtst\\T01_Region_References");

            byte[] data = { 1, 3, 4, 5, 6, 7, 8, 9, 10 };
            bool delegate_called = false;

            {
                // put some data in the region
                IRegion region1 = rm.writeFreshRegionAddr(0, BLOCK_SIZE);
                {
                    Stream output = region1.getNewAccessStream();
                    output.Write(data, 0, data.Length);
                    output.Dispose();
                }
                region1 = null;
            }
            System.GC.Collect();

            {
                IRegion region2 = rm.readRegionAddrNonExcl(0);
                Stream rd1 = region2.getNewAccessStream();
                rm.notifyRegionSafeToFree(0, delegate(long addr) {
                    System.Console.WriteLine("** region safe to free delegate called");
                    delegate_called = true;
                });
                rd1 = null;
                region2 = null;
            }
            rm = null;

            for (int x = 0; x < 1000; x++) {
                Thread.Sleep(5);
                System.GC.Collect();
                if (delegate_called) { break; }
            }
            Assert.AreEqual(true, delegate_called, "region was never safe to free");
        }
All Usage Examples Of Bend.RegionExposedFiles::readRegionAddrNonExcl