コード例 #1
0
        public override Object Clone()
        {
            IndexInput clone = null;

            try {
                this.fileMutex.WaitOne();
                clone = new CachedIndexInput(this);
            } finally {
                this.fileMutex.ReleaseMutex();
            }
            Debug.Assert(clone != null);
            return(clone);
        }
コード例 #2
0
        // ctor for clone
        private CachedIndexInput(CachedIndexInput cloneInput)
        {
            this.name      = cloneInput.name;
            this.fileMutex = BlobMutexManager.GrabMutex(this.name);
            this.fileMutex.WaitOne();

            try {
#if FULLDEBUG
                Debug.WriteLine("Creating clone for " + this.name);
#endif
                this.indexInput = cloneInput.indexInput.Clone() as IndexInput;
                // FRAGILE: ASSUME: File is already downloaded and current
            } catch (Exception) {
                // sometimes we get access denied on the 2nd stream...but not always. I haven't tracked it down yet but this covers our tail until I do
                Debug.WriteLine("Dagnabbit, falling back to memory clone for " + this.name);
            } finally {
                this.fileMutex.ReleaseMutex();
            }
        }
コード例 #3
0
 public override Object Clone()
 {
     IndexInput clone = null;
     try {
         this.fileMutex.WaitOne();
         clone = new CachedIndexInput( this );
     } finally {
         this.fileMutex.ReleaseMutex();
     }
     Debug.Assert( clone != null );
     return clone;
 }
コード例 #4
0
        // ctor for clone
        private CachedIndexInput( CachedIndexInput cloneInput )
        {
            this.name = cloneInput.name;
            this.fileMutex = BlobMutexManager.GrabMutex( this.name );
            this.fileMutex.WaitOne();

            try {
            #if FULLDEBUG
                Debug.WriteLine( "Creating clone for " + this.name );
            #endif
                this.indexInput = cloneInput.indexInput.Clone() as IndexInput;
                // FRAGILE: ASSUME: File is already downloaded and current
            } catch ( Exception ) {
                // sometimes we get access denied on the 2nd stream...but not always. I haven't tracked it down yet but this covers our tail until I do
                Debug.WriteLine( "Dagnabbit, falling back to memory clone for " + this.name );
            } finally {
                this.fileMutex.ReleaseMutex();
            }
        }