kodi
PyContext.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 namespace XBMCAddon
12 {
13  namespace Python
14  {
15  class PyGILLock;
16 
22  class PyContext
23  {
24  protected:
25  friend class PyGILLock;
26  static void* enterContext();
27  static void leaveContext();
28  public:
29 
30  inline PyContext() { enterContext(); }
31  inline ~PyContext() { leaveContext(); }
32  };
33 
39  class PyGILLock
40  {
41  public:
42  static void releaseGil();
43  static void acquireGil();
44 
45  inline PyGILLock() { releaseGil(); }
46  inline ~PyGILLock() { acquireGil(); }
47  };
48  }
49 }
This class supports recursive locking of the GIL.
Definition: PyContext.h:39
These classes should NOT be used with 'new'.
Definition: PyContext.h:22
Defining LOG_LIFECYCLE_EVENTS will log all instantiations, deletions and also reference countings (in...
Definition: Addon.cpp:25