ultimatepp/bazaar/PyShell/PyShell.h
kohait 6ecf478516 bazaar: Python: some python test cases, very basic and alpha
git-svn-id: svn://ultimatepp.org/upp/trunk@3319 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2011-03-30 21:04:06 +00:00

33 lines
534 B
C++

#ifndef _PyShell_PyShell_h
#define _PyShell_PyShell_h
#include <Python/Python.h>
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
//ONLY WORKS IN OPTIMAL, DEBUG needs TkTcl as DEBUG????
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