-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCSWPythonable.cpp
More file actions
64 lines (44 loc) · 1.13 KB
/
CSWPythonable.cpp
File metadata and controls
64 lines (44 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) 2005-2022 Andreas Rose. All rights reserved.
// Released under the MIT license. (see license.txt)
#include "PrecompiledHeader.h"
#include "CSWPythonable.h"
#include "CSWWorld.h"
namespace CodeSubWars
{
CSWPythonable::PtrType CSWPythonable::create()
{
return PtrType(new CSWPythonable());
}
CSWPythonable::~CSWPythonable()
{
}
void CSWPythonable::setThreadState(PyThreadState* pThreadState)
{
m_pThreadState = pThreadState;
}
PyThreadState* CSWPythonable::getThreadState()
{
return m_pThreadState;
}
void CSWPythonable::finalizePython()
{
//if (m_pThreadState)
//{
// //gil must not be held
// PyEval_AcquireThread(m_pThreadState);
// //gil held
// //PyEval_AcquireThread(state);
// Py_EndInterpreter(m_pThreadState);
// //gil held
// PyThreadState_Swap(CSWWorld::getInstance()->getPyMainState());
// //gil must be held
// PyEval_ReleaseThread(CSWWorld::getInstance()->getPyMainState());
// //gil not held
// m_pThreadState = NULL;
//}
}
CSWPythonable::CSWPythonable()
: m_pThreadState(nullptr)
{
}
}