37 Commits

Author SHA1 Message Date
Julian Brost
24b57f0d3a Namespace: don't acquire shared locks on frozen namespaces
This makes freezing a namespace an irrevocable operation but in return allows
omitting further lock operations. This results in a performance improvement as
reading an atomic bool is faster than acquiring and releasing a shared lock.

ObjectLocks on namespaces remain untouched as these mostly affect write
operations which there should be none of after freezing (if there are some,
they will throw exceptions anyways).
2023-01-19 17:56:44 +01:00
Julian Brost
1c066fc02e Simplify NamespaceValue class hierarchy to one struct without member functions
This commit removes EmbeddedNamespaceValue and ConstEmbeddedNamespaceValue and
reduces NamespaceValue down to a simple struct without inheritance or member
functions. The code from these clases is inlined into the Namespace class. The
class hierarchy determining whether a value is const is moved to an attribute
of NamespaceValue.

This is done in preparation for changes to the locking in the Namespace class.
Currently, it relies on a recursive mutex. In the future, a shared mutex
(read/write lock) should be used instead, which cannot allow recursive locking
(without failing or risk deadlocking on lock upgrades). With this change, all
operations requiring a lock for one operation are within one function, no
recursive locking is not needed any more.
2023-01-19 17:55:11 +01:00
Julian Brost
99bb687350 INITIALIZE_ONCE_WITH_PRIORITY: use enum for priority values
Change the type of the priority values from int to a new enum. By replacing the
magic int values throughout the code base with named values, there is now a
single place where all priority values are defined and you get an overview over
the initialization order.
2023-01-18 15:57:27 +01:00
Alexander A. Klimov
768044a754 Replace std::shared_ptr<NamespaceValue> with NamespaceValue::Ptr
refs #7361
2019-10-21 17:10:51 +02:00
Michael Friedrich
d14a88235d Replace Copyright header with a short version, part I
CLion -> replace in path
2019-02-25 14:48:22 +01:00
Michael Friedrich
dab53448bc icinga.com: Update *.{h,c}pp 2018-10-18 09:27:04 +02:00
Michael Friedrich
19993df380 Fix static initializer priority for namespaces in LTO builds
fixes #6575
2018-09-04 16:36:22 +02:00
Gunnar Beutner
1a8692d972 Implement support for namespaces 2018-08-13 13:44:31 +02:00
Gunnar Beutner
d9c0b6f806 Refactor REGISTER_SCRIPTFUNCTION_* macros 2018-08-13 13:44:31 +02:00
Gunnar Beutner
9d436605f0 Fix compatibility with CMake < 3.1 2018-01-18 15:12:46 +01:00
Gunnar Beutner
621eed3f13 Apply clang-tidy fix 'modernize-pass-by-value' 2018-01-04 12:24:57 +01:00
Gunnar Beutner
9ca682496c Apply clang-tidy fix 'modernize-use-override' 2018-01-04 12:24:57 +01:00
Gunnar Beutner
ac155d1dda Apply clang-tidy fix 'modernize-redundant-void-arg' 2018-01-04 12:24:57 +01:00
Gunnar Beutner
efe99a3e5e Add the final keyword to classes 2018-01-04 05:20:20 +00:00
Gunnar Beutner
90496b5456 Build libraries as static libraries 2018-01-02 23:29:48 +01:00
Michael Insel
158ae2188e Change copyright header for 2018 2018-01-02 12:08:55 +01:00
Jean Flach
2636e6a77a Whitespace fix
What does this change?
* Remove use of spaces for formatting
These could be found by using `grep -r -l -P '^\t+ +[^*]'
* Removal of training whitespaces
* A few lines longer than 120 chars
2017-12-20 14:53:52 +01:00
Jean Flach
f40f366e9e Remove unnecessary inline statements
fixes #5886
2017-12-20 13:22:38 +01:00
Gunnar Beutner
3c60fbf75d Use std::vector::emplace_back instead of std::vector::push_back 2017-11-30 17:47:09 +01:00
Gunnar Beutner
d5961bb76c Re-implement WrapFunction() using C++11 features 2017-11-29 11:53:45 +01:00
Gunnar Beutner
858873b940 Replace boost::bind/boost::function with std::bind/std::function 2017-11-27 15:15:11 +01:00
Gunnar Beutner
5d45c74be3 Improve function metadata by adding arguments
fixes #5087
2017-03-27 14:43:19 +02:00
Michael Friedrich
b7caf0820d Ensure that *.icinga.com is used everywhere
fixes #13897
fixes #13277
2017-01-10 17:19:12 +01:00
Gunnar Beutner
b5b09216c6 Use lambda functions for INITIALIZE_ONCE
fixes #12562
2016-08-27 09:48:36 +02:00
Gunnar Beutner
91577713fd Fix incorrect function name for deprecated functions
refs #12408
2016-08-12 15:41:03 +02:00
Gunnar Beutner
24431b3dab Register deprecated methods in the 'Deprecated' namespace
refs #12408
2016-08-12 13:42:22 +02:00
Gunnar Beutner
c5a170a972 Implement support for namespaces
fixes #12408
2016-08-12 11:32:16 +02:00
Gunnar Beutner
e09fb88cae Make sure functions are registered with the correct prefix
refs #12393
2016-08-10 16:33:17 +02:00
Gunnar Beutner
54bbaf9f7d Implement support for marking functions as deprecated
fixes #12393
2016-08-10 15:48:05 +02:00
Gunnar Beutner
dc06209e4a Move internal script functions into the 'Internal' namespace
fixes #12338
2016-08-10 06:55:44 +02:00
Gunnar Beutner
8deeb73bb8 Register a new script frame in Function::Invoke
fixes #9848
2016-08-08 14:12:08 +02:00
Gunnar Beutner
599929b0f6 Update copyright headers for 2016 2016-01-12 08:29:59 +01:00
Michael Friedrich
545607be9f Fix that custom attribute with function value cannot be cloned
fixes #10583
2015-11-11 14:18:25 +01:00
Gunnar Beutner
d93bcedaad Implement sandbox mode for the config parser
fixes #9068
2015-04-16 08:48:17 +02:00
Gunnar Beutner
e3dcc8a610 Implement a unit test for nullary lambdas
fixes #7805
2015-02-03 14:02:32 +01:00
Michael Friedrich
78bfd0204c Update copyright year 2015-01-22 12:00:23 +01:00
Gunnar Beutner
363f23b1d8 Rename ScriptFunction to Function
fixes #8258
2015-01-21 08:48:38 +01:00