Digy wrote:
1) File Descriptor syncing in FSDirectory.cs

       [System.Runtime.InteropServices.DllImport("kernel32")]

       public static extern int
FlushFileBuffers(Microsoft.Win32.SafeHandles.SafeFileHandle SafeFileHandle);

       public static void Sync(FileStream fs)

       {

           if (FlushFileBuffers(fs.SafeFileHandle) == 0)

           {

               throw new SyncFailedException();

           }

       }

       public class SyncFailedException : Exception

       {

       }

   I am not sure about committing this patch. Since it uses InteropServices,
It may cause problems on Mono.

When using Mono under Unix, calling FileStream.Flush() is sufficient because this method eventually calls fsync(2)..

When using Mono under Windows, FileStream.Flush() will call
the FlushFileBuffers() Win32 API.

So the real question is: does MS.NET's FileStream.Flush() call
FlushFileBuffers() as well? If yes, the code above can be replaced
with a simple fs.Flush ().

Robert

Reply via email to