tesseract  4.1.1
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_ambigs_for_adaption, false, "Use ambigs for deciding"
21  " whether to adapt to a character", &params_) {
22 }
23 
24 // Destructor.
25 // It is defined here, so the compiler can create a single vtable
26 // instead of weak vtables in every compilation unit.
27 CCUtil::~CCUtil() = default;
28 
30 #ifdef _WIN32
31  mutex_ = CreateMutex(0, FALSE, 0);
32 #else
33  pthread_mutex_init(&mutex_, nullptr);
34 #endif
35 }
36 
38 #ifdef _WIN32
39  WaitForSingleObject(mutex_, INFINITE);
40 #else
41  pthread_mutex_lock(&mutex_);
42 #endif
43 }
44 
46 #ifdef _WIN32
47  ReleaseMutex(mutex_);
48 #else
49  pthread_mutex_unlock(&mutex_);
50 #endif
51 }
52 
53 } // namespace tesseract
#define BOOL_MEMBER(name, val, comment, vec)
Definition: params.h:318
#define FALSE
Definition: capi.h:52
#define INT_INIT_MEMBER(name, val, comment, vec)
Definition: params.h:327