MySQL 9.3.0
Source Code Documentation
polyglot_scope.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024, 2025, Oracle and/or its affiliates.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2.0,
6 * as published by the Free Software Foundation.
7 *
8 * This program is designed to work with certain software (including
9 * but not limited to OpenSSL) that is licensed under separate terms,
10 * as designated in a particular file or component or in included license
11 * documentation. The authors of MySQL hereby grant you an additional
12 * permission to link the program and your derivative works with the
13 * separately licensed software that they have either included with
14 * the program or referenced in the documentation.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
19 * the GNU General Public License, version 2.0, for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26#ifndef MYSQLSHDK_SCRIPTING_POLYGLOT_UTILS_POLYGLOT_SCOPE_H_
27#define MYSQLSHDK_SCRIPTING_POLYGLOT_UTILS_POLYGLOT_SCOPE_H_
28
30
31namespace shcore {
32namespace polyglot {
33
34/**
35 * Utility class to create a polyglot handle scope which is wiped out as soon as
36 * the instance goes out of scope in C++, this is used to avoid polluting the
37 * main scope with references preventing garbage collection from cleaning no
38 * longer needed objects.
39 */
40class Polyglot_scope final {
41 public:
42 Polyglot_scope() = delete;
43 explicit Polyglot_scope(poly_thread thread);
44
45 Polyglot_scope(const Polyglot_scope &) = delete;
47
50
51 void close();
52
54
55 private:
56 poly_thread m_thread;
57 bool m_open = false;
58};
59} // namespace polyglot
60} // namespace shcore
61
62#endif // MYSQLSHDK_SCRIPTING_POLYGLOT_UTILS_POLYGLOT_SCOPE_H_
Utility class to create a polyglot handle scope which is wiped out as soon as the instance goes out o...
Definition: polyglot_scope.h:40
Polyglot_scope(const Polyglot_scope &)=delete
poly_thread m_thread
Definition: polyglot_scope.h:56
Polyglot_scope & operator=(const Polyglot_scope &)=delete
bool m_open
Definition: polyglot_scope.h:57
void close()
Definition: polyglot_scope.cc:43
Polyglot_scope & operator=(Polyglot_scope &&)=delete
~Polyglot_scope()
Definition: polyglot_scope.h:53
Polyglot_scope(Polyglot_scope &&)=delete
Definition: file_system_exceptions.h:34