diff options
author | Matthew Newhook <matthew@zeroc.com> | 2015-03-21 15:35:40 -0230 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2015-03-21 15:35:40 -0230 |
commit | 630a37d2fe66f24518299e705f958b571803c522 (patch) | |
tree | 969723791bdc4d73bb099c19d45554d0ca241ad9 /py/modules/IcePy/Thread.cpp | |
parent | Fix some README.md markdown formatting (diff) | |
download | ice-630a37d2fe66f24518299e705f958b571803c522.tar.bz2 ice-630a37d2fe66f24518299e705f958b571803c522.tar.xz ice-630a37d2fe66f24518299e705f958b571803c522.zip |
py -> python
rb -> ruby
objc -> objective-c
cs -> csharp
Diffstat (limited to 'py/modules/IcePy/Thread.cpp')
-rw-r--r-- | py/modules/IcePy/Thread.cpp | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/py/modules/IcePy/Thread.cpp b/py/modules/IcePy/Thread.cpp deleted file mode 100644 index 379b7556e47..00000000000 --- a/py/modules/IcePy/Thread.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifdef _WIN32 -# include <IceUtil/Config.h> -#endif -#include <Thread.h> - -using namespace std; -using namespace IcePy; - -IcePy::AllowThreads::AllowThreads() -{ - _state = PyEval_SaveThread(); -} - -IcePy::AllowThreads::~AllowThreads() -{ - PyEval_RestoreThread(_state); -} - -IcePy::AdoptThread::AdoptThread() -{ - _state = PyGILState_Ensure(); -} - -IcePy::AdoptThread::~AdoptThread() -{ - PyGILState_Release(_state); -} - -IcePy::ThreadHook::ThreadHook(PyObject* threadNotification) : - _threadNotification(threadNotification) -{ - Py_INCREF(threadNotification); -} - -void -IcePy::ThreadHook::start() -{ - AdoptThread adoptThread; // Ensure the current thread is able to call into Python. - - PyObjectHandle tmp = PyObject_CallMethod(_threadNotification.get(), STRCAST("start"), 0); - if(!tmp.get()) - { - throwPythonException(); - } -} - -void -IcePy::ThreadHook::stop() -{ - AdoptThread adoptThread; // Ensure the current thread is able to call into Python. - - PyObjectHandle tmp = PyObject_CallMethod(_threadNotification.get(), STRCAST("stop"), 0); - if(!tmp.get()) - { - throwPythonException(); - } -} - -PyObject* -IcePy::ThreadHook::getObject() -{ - return _threadNotification.get(); -} |