tesseract  4.1.0
ccutil.cpp
Go to the documentation of this file.
1 // Copyright 2008 Google Inc. All Rights Reserved.
2 // Author: scharron@google.com (Samuel Charron)
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 // http://www.apache.org/licenses/LICENSE-2.0
7 // Unless required by applicable law or agreed to in writing, software
8 // distributed under the License is distributed on an "AS IS" BASIS,
9 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 // See the License for the specific language governing permissions and
11 // limitations under the License.
12 
13 #include "ccutil.h"
14 
15 namespace tesseract {
17  params_(),
18  INT_INIT_MEMBER(ambigs_debug_level, 0, "Debug level for unichar ambiguities",
19  &params_),
20  BOOL_MEMBER(use_definite_ambigs_for_classifier, false, "Use definite"
21  " ambiguities when running character classifier", &params_),
22  BOOL_MEMBER(use_ambigs_for_adaption, false, "Use ambigs for deciding"
23  " whether to adapt to a character", &params_) {
24 }
25 
26 // Destructor.
27 // It is defined here, so the compiler can create a single vtable
28 // instead of weak vtables in every compilation unit.
29 CCUtil::~CCUtil() = default;
30 
32 #ifdef _WIN32
33  mutex_ = CreateMutex(0, FALSE, 0);
34 #else
35  pthread_mutex_init(&mutex_, nullptr);
36 #endif
37 }
38 
40 #ifdef _WIN32
41  WaitForSingleObject(mutex_, INFINITE);
42 #else
43  pthread_mutex_lock(&mutex_);
44 #endif
45 }
46 
48 #ifdef _WIN32
49  ReleaseMutex(mutex_);
50 #else
51  pthread_mutex_unlock(&mutex_);
52 #endif
53 }
54 
55 CCUtilMutex tprintfMutex; // should remain global
56 } // namespace tesseract
CCUtilMutex tprintfMutex
Definition: ccutil.cpp:55
#define BOOL_MEMBER(name, val, comment, vec)
Definition: params.h:318
#define INT_INIT_MEMBER(name, val, comment, vec)
Definition: params.h:327
#define FALSE
Definition: capi.h:52