From 122ed08d72265e3abb02c48c4be804d793058fc9 Mon Sep 17 00:00:00 2001 From: Philip Rinn Date: Fri, 5 Jan 2018 15:22:47 +0100 Subject: [PATCH] Run OpenMP once before calling tesseract (fixes: #285) --- gtk/src/main.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gtk/src/main.cc b/gtk/src/main.cc index a2668e45..9fec77a5 100644 --- a/gtk/src/main.cc +++ b/gtk/src/main.cc @@ -94,6 +94,12 @@ int main (int argc, char *argv[]) { } #endif + // Run OpenMP once before tesseract is called, otherwise it might be + // _very_ slow, see https://github.com/manisandro/gImageReader/issues/285 + // Sleep 1 millisecond to prevent being optimized out. + #pragma omp parallel for schedule(static) + for(int i = 0; i < 1; i++) { sleep(1); } + std::string localeDir = Glib::build_filename(pkgDir, "share", "locale"); bindtextdomain(GETTEXT_PACKAGE, localeDir.c_str());