ultimatepp/bazaar/PyShell/PyShell.h
kohait 7f2fe06635 bazaar: Python to Py rename to avoid ambiguity, Py prepare for boost use, fixes in PyConsoleCtrl to post result objects
git-svn-id: svn://ultimatepp.org/upp/trunk@3329 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2011-04-07 16:21:09 +00:00

31 lines
467 B
C++

#ifndef _PyShell_PyShell_h
#define _PyShell_PyShell_h
#include <Py/Py.h>
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
class PyShell
{
public:
typedef PyShell CLASSNAME;
PyShell() : a(0) {}
void Start()
{
if(IsRunning()) return;
Wait();
if(!t.IsOpen()) t.Run(THISBACK(Proc));
}
void Wait() { t.Wait(); }
bool IsRunning() const { return AtomicRead(a>0); }
void Proc();
protected:
Atomic a;
Thread t;
};
#endif