diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2005-03-09 04:58:11 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2005-03-09 04:58:11 +0000 |
commit | e854889b99b9e515dc69d237b1031b5705e83b60 (patch) | |
tree | 6b525184d850f15012e316ca51cf0a11563261ea /externals/grill/py/source/main.cpp | |
parent | 9ccbbc943fa25426542b4fb6d6bc280c3281001b (diff) |
fixes for detached operation and single-threaded version
use lock count instead of message queuing to avoid py->py messaging deadlock
support for buffer objects (preliminary)
updated build system
little restructuring
fixes for single-threaded compilation
added support for numarray
svn path=/trunk/; revision=2610
Diffstat (limited to 'externals/grill/py/source/main.cpp')
-rw-r--r-- | externals/grill/py/source/main.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/externals/grill/py/source/main.cpp b/externals/grill/py/source/main.cpp index 01dc0afa..c24f998c 100644 --- a/externals/grill/py/source/main.cpp +++ b/externals/grill/py/source/main.cpp @@ -60,6 +60,7 @@ void py::FreeThreadState() void initsymbol(); +void initsamplebuffer(); void py::lib_setup() { @@ -69,12 +70,11 @@ void py::lib_setup() post("(C)2002-2005 Thomas Grill - http://grrrr.org/ext"); post(""); post("using Python %s",Py_GetVersion()); + #ifdef FLEXT_DEBUG post(""); post("DEBUG version compiled on %s %s",__DATE__,__TIME__); #endif - post("------------------------------------------------"); - post(""); // ------------------------------------------------------------- @@ -115,6 +115,10 @@ void py::lib_setup() PyModule_AddObject(module_obj,"_s_float",(PyObject *)pySymbol_float); PyModule_AddObject(module_obj,"_s_int",(PyObject *)pySymbol_int); + // add samplebuffer type + initsamplebuffer(); + PyModule_AddObject(module_obj,"Buffer",(PyObject *)&pySamplebuffer_Type); + // redirect stdout PyObject* py_out; py_out = Py_InitModule("stdout", StdOut_Methods); @@ -138,6 +142,9 @@ void py::lib_setup() // release global lock PyEval_ReleaseLock(); #endif + + post("------------------------------------------------"); + post(""); } FLEXT_LIB_SETUP(py,py::lib_setup) @@ -189,12 +196,14 @@ void py::Exit() qucond.Signal(); if(thrcount) { // Wait for a certain time - for(int i = 0; i < (PY_STOP_WAIT/PY_STOP_TICK) && thrcount; ++i) Sleep(PY_STOP_TICK/1000.f); - - // Wait forever - post("%s - Waiting for thread termination!",thisName()); - while(thrcount) Sleep(PY_STOP_TICK/1000.f); - post("%s - Okay, all threads have terminated",thisName()); + for(int i = 0; i < (PY_STOP_WAIT/PY_STOP_TICK) && thrcount; ++i) + Sleep(PY_STOP_TICK*0.001f); + if(thrcount) { + // Wait forever + post("%s - Waiting for thread termination!",thisName()); + while(thrcount) Sleep(PY_STOP_TICK*0.001f); + post("%s - Okay, all threads have terminated",thisName()); + } } #endif flext_base::Exit(); |