diff --git a/src/coreclr/pal/src/init/pal.cpp b/src/coreclr/pal/src/init/pal.cpp index a51feb390b44c..63ee86e291ff7 100644 --- a/src/coreclr/pal/src/init/pal.cpp +++ b/src/coreclr/pal/src/init/pal.cpp @@ -382,16 +382,6 @@ Initialize( goto CLEANUP0a; } - if (flags & PAL_INITIALIZE_FLUSH_PROCESS_WRITE_BUFFERS) - { - // Initialize before first thread is created for faster load on Linux - if (!InitializeFlushProcessWriteBuffers()) - { - palError = ERROR_PALINIT_INITIALIZE_FLUSH_PROCESS_WRITE_BUFFERS; - goto CLEANUP0a; - } - } - // The gSharedFilesPath is allocated dynamically so its destructor does not get // called unexpectedly during cleanup gSharedFilesPath = InternalNew(); @@ -639,6 +629,17 @@ Initialize( goto CLEANUP10; } + if (flags & PAL_INITIALIZE_FLUSH_PROCESS_WRITE_BUFFERS) + { + // Initialize before first thread is created for faster load on Linux + if (!InitializeFlushProcessWriteBuffers()) + { + ERROR("Unable to initialize flush process write buffers\n"); + palError = ERROR_PALINIT_INITIALIZE_FLUSH_PROCESS_WRITE_BUFFERS; + goto CLEANUP10; + } + } + if (flags & PAL_INITIALIZE_SYNC_THREAD) { //