- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
Files
/
Copy pathsystem.cpp
Latest commit
2898 lines (2552 loc) · 87.2 KB
1
/*M///////////////////////////////////////////////////////////////////////////////////////
2
//
3
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4
//
5
// By downloading, copying, installing or using the software you agree to this license.
6
// If you do not agree to this license, do not download, install,
7
// copy or use the software.
8
//
9
//
10
// License Agreement
11
// For Open Source Computer Vision Library
12
//
13
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15
// Copyright (C) 2015, Itseez Inc., all rights reserved.
16
// Third party copyrights are property of their respective owners.
17
//
18
// Redistribution and use in source and binary forms, with or without modification,
19
// are permitted provided that the following conditions are met:
20
//
21
// * Redistribution's of source code must retain the above copyright notice,
22
// this list of conditions and the following disclaimer.
23
//
24
// * Redistribution's in binary form must reproduce the above copyright notice,
25
// this list of conditions and the following disclaimer in the documentation
26
// and/or other materials provided with the distribution.
27
//
28
// * The name of the copyright holders may not be used to endorse or promote products
29
// derived from this software without specific prior written permission.
30
//
31
// This software is provided by the copyright holders and contributors "as is" and
32
// any express or implied warranties, including, but not limited to, the implied
33
// warranties of merchantability and fitness for a particular purpose are disclaimed.
34
// In no event shall the Intel Corporation or contributors be liable for any direct,
35
// indirect, incidental, special, exemplary, or consequential damages
36
// (including, but not limited to, procurement of substitute goods or services;
37
// loss of use, data, or profits; or business interruption) however caused
38
// and on any theory of liability, whether in contract, strict liability,
39
// or tort (including negligence or otherwise) arising in any way out of
40
// the use of this software, even if advised of the possibility of such damage.
41
//
42
//M*/
43
44
#include "precomp.hpp"
45
#include <atomic>
46
#include <iostream>
47
#include <ostream>
48
49
#ifdef __QNX__
50
#include <unistd.h>
51
#include <sys/neutrino.h>
52
#include <sys/syspage.h>
53
#ifdef __aarch64__
54
#include <aarch64/syspage.h>
55
#endif
56
#endif
57
58
#include <opencv2/core/utils/configuration.private.hpp>
59
#include <opencv2/core/utils/trace.private.hpp>
60
61
#include <opencv2/core/utils/logger.hpp>
62
63
#include <opencv2/core/utils/tls.hpp>
64
#include <opencv2/core/utils/instrumentation.hpp>
65
66
#include <opencv2/core/utils/filesystem.private.hpp>
67
68
#include <opencv2/core/utils/fp_control_utils.hpp>
69
#include <opencv2/core/utils/fp_control.private.hpp>
70
71
namespace cv {
72
73
static void _initSystem()
74
{
75
#ifdef __ANDROID__
76
// https://github.com/opencv/opencv/issues/14906
77
// "ios_base::Init" object is not a part of Android's "iostream" header (in case of clang toolchain, NDK 20).
78
// Ref1: https://en.cppreference.com/w/cpp/io/ios_base/Init
79
// The header <iostream> behaves as if it defines (directly or indirectly) an instance of std::ios_base::Init with static storage duration
80
// Ref2: https://github.com/gcc-mirror/gcc/blob/gcc-8-branch/libstdc%2B%2B-v3/include/std/iostream#L73-L74
81
static std::ios_base::Init s_iostream_initializer;
82
#endif
83
}
84
85
static Mutex* __initialization_mutex = NULL;
86
Mutex& getInitializationMutex()
87
{
88
if (__initialization_mutex == NULL)
89
{
90
(void)_initSystem();
91
__initialization_mutex = new Mutex();
92
}
93
return *__initialization_mutex;
94
}
95
// force initialization (single-threaded environment)
96
Mutex* __initialization_mutex_initializer = &getInitializationMutex();
97
98
static bool param_dumpErrors = utils::getConfigurationParameterBool("OPENCV_DUMP_ERRORS",
99
#if defined(_DEBUG) || defined(__ANDROID__)
100
true
101
#else