Ejemplo n.º 1
0
        /// <summary>
        /// Replaces the content of the memory mapped file with a write lock in place.
        /// </summary>
        public void Write(byte[] data)
        {
            if (data is null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            if (data.Length > MaxFileSize)
            {
                throw new ArgumentOutOfRangeException(nameof(data), "Length greater than max file size");
            }

            readWriteLock.AcquireWriteLock();

            try
            {
                InternalWrite(data);
            }
            finally
            {
                readWriteLock.ReleaseWriteLock();
                fileWaitHandle.Set();
                fileWaitHandle.Reset();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Replaces the content of the memory mapped file with a write lock in place.
        /// </summary>
        public void Write(byte[] data)
        {
            if (data.Length > maxFileSize)
            {
                throw new ArgumentOutOfRangeException(nameof(data), "Length greater than max file size");
            }

            readWriteLock.AcquireWriteLock();

            try
            {
                InternalWrite(data);
            }
            finally
            {
                readWriteLock.ReleaseWriteLock();
            }
        }