]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/PreviewLoader.cpp
Use only one file for dummy implementations
[lyx.git] / src / graphics / PreviewLoader.cpp
index f8c1d7e6c34ae22b47a1d8ee82551c3d147a6854..e9b1d47202c2a4a4288a6f97227eeeddce48c66d 100644 (file)
@@ -93,12 +93,22 @@ lyx::Converter const * setConverter(string const & from)
        }
 
        // Show the error only once
+#ifdef LYX_USE_STD_CALL_ONCE
+       // This is thread-safe.
        static once_flag flag;
        call_once(flag, [&](){
                        LYXERR0("PreviewLoader::startLoading()\n"
                                << "No converter from \"" << from
                                << "\" format has been defined.");
                });
+#else
+       // This is also thread-safe according to ยง6.7.4 of the C++11 standard.
+       static bool once = ([&]{
+                       LYXERR0("PreviewLoader::startLoading()\n"
+                               << "No converter from \"" << from
+                               << "\" format has been defined.");
+               } (), true);
+#endif
        return 0;
 }