Last change
on this file since 3099 was 3046, checked in by Takeshi Nakazato, 9 years ago |
New Development: No
JIRA Issue: Yes CAS-7764
Ready for Test: Yes
Interface Changes: Yes/No
What Interface Changed: Please list interface changes
Test Programs: List test programs
Put in Release Notes: Yes/No
Module(s): Module Names change impacts.
Description:
Release GIL in some time-consuming functions. Currently the following functions releases GIL:
- MSFiller::fill
- MSWriter::write
- Scantable::applyBaselineTable
- Scantable::subBaseline
- CalibrationManager::calibrate
- CalibrationManager::apply
|
-
Property svn:mime-type
set to
text/plain
|
File size:
730 bytes
|
Line | |
---|
1 |
|
---|
2 | #ifndef _ASAP_GIL_HANDLER_H_
|
---|
3 | #define _ASAP_GIL_HANDLER_H_
|
---|
4 |
|
---|
5 | //#include <iostream>
|
---|
6 | #include <Python.h>
|
---|
7 |
|
---|
8 | namespace {
|
---|
9 | inline PyThreadState *SaveThreadState()
|
---|
10 | {
|
---|
11 | //std::cout << "SaveThreadState" << std::endl;
|
---|
12 | return PyEval_SaveThread();
|
---|
13 | }
|
---|
14 |
|
---|
15 | inline void RestoreThreadState(PyThreadState *state)
|
---|
16 | {
|
---|
17 | //std::cout << "RestoreThreadState" << std::endl;
|
---|
18 | PyEval_RestoreThread(state);
|
---|
19 | }
|
---|
20 | }
|
---|
21 |
|
---|
22 | namespace asap {
|
---|
23 |
|
---|
24 | class GILHandler {
|
---|
25 | public:
|
---|
26 | GILHandler()
|
---|
27 | {
|
---|
28 | #ifdef USE_CASAPY
|
---|
29 | threadState_ = SaveThreadState();
|
---|
30 | #endif
|
---|
31 | }
|
---|
32 |
|
---|
33 | ~GILHandler()
|
---|
34 | {
|
---|
35 | #ifdef USE_CASAPY
|
---|
36 | RestoreThreadState(threadState_);
|
---|
37 | threadState_ = NULL;
|
---|
38 | #endif
|
---|
39 | }
|
---|
40 |
|
---|
41 | private:
|
---|
42 | PyThreadState *threadState_;
|
---|
43 | };
|
---|
44 |
|
---|
45 | }
|
---|
46 |
|
---|
47 | #endif /* _ASAP_GIL_HANDLER_H_ */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.