snakefoot commented on PR #92:
URL: https://github.com/apache/logging-log4net/pull/92#issuecomment-3185530113

   Just curious how does NoLock work when having two file-handles to the same 
file ?
   
   Forexample:
   - File-handle-1 writes 10 bytes, and moves its file-position 10 byte forward
   - File-handle-2 writes 20 bytes and moves its file-position 20 bytes forward
   
   Will File-Handle-2 not overwrite the contents just written by File-Handle-1 ?
   
   With the following code:
   ```c#
    using var fileStream1 = new FileStream(@"C:\Temp\Hello.txt", 
FileMode.Append, FileAccess.Write, FileShare.ReadWrite, 1, FileOptions.None);
    using var fileStream2 = new FileStream(@"C:\Temp\Hello.txt", 
FileMode.Append, FileAccess.Write, FileShare.ReadWrite, 1, FileOptions.None);
    fileStream1.Write(System.Text.Encoding.UTF8.GetBytes("Hello"));
    fileStream2.Write(System.Text.Encoding.UTF8.GetBytes("Goodbye World"));
    fileStream1.Write(System.Text.Encoding.UTF8.GetBytes("World"));
   ```
   Then the contents of the output-file becomes this:
   ```
   GoodbWorldrld
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to