From 53c16e06983f9b03464f41b8c0ed3206382c5538 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sun, 9 Jan 2005 04:59:30 +0000 Subject: support for Python threads, at last small fixes merged in 20041229-newdetach branch. renamed locking functions svn path=/trunk/; revision=2483 --- externals/grill/py/source/bound.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'externals/grill/py/source/bound.cpp') diff --git a/externals/grill/py/source/bound.cpp b/externals/grill/py/source/bound.cpp index 2504dde0..ce17578c 100644 --- a/externals/grill/py/source/bound.cpp +++ b/externals/grill/py/source/bound.cpp @@ -2,7 +2,7 @@ py/pyext - python external object for PD and MaxMSP -Copyright (c) 2002-2004 Thomas Grill (gr@grrrr.org) +Copyright (c)2002-2005 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -21,11 +21,12 @@ struct bounddata FuncSet funcs; }; -bool pyext::boundmeth(flext_base *,t_symbol *sym,int argc,t_atom *argv,void *data) +bool pyext::boundmeth(flext_base *th,t_symbol *sym,int argc,t_atom *argv,void *data) { bounddata *obj = (bounddata *)data; + py *pyth = static_cast(th); - PY_LOCK + PyThreadState *state = pyth->PyLock(); PyObject *args = MakePyArgs(sym,argc,argv,-1,obj->self != NULL); @@ -40,14 +41,14 @@ bool pyext::boundmeth(flext_base *,t_symbol *sym,int argc,t_atom *argv,void *dat Py_XDECREF(args); - PY_UNLOCK + pyth->PyUnlock(state); return true; } PyObject *pyext::pyext_bind(PyObject *,PyObject *args) { PyObject *self,*meth; - C *name; + char *name; if(!PyArg_ParseTuple(args, "OsO:pyext_bind", &self,&name,&meth)) post("py/pyext - Wrong arguments!"); else if(!PyInstance_Check(self) || !(PyMethod_Check(meth) || PyFunction_Check(meth))) { @@ -91,7 +92,7 @@ PyObject *pyext::pyext_bind(PyObject *,PyObject *args) PyObject *pyext::pyext_unbind(PyObject *,PyObject *args) { PyObject *self,*meth; - C *name; + char *name; if(!PyArg_ParseTuple(args, "OsO:pyext_bind", &self,&name,&meth)) post("py/pyext - Wrong arguments!"); else if(!PyInstance_Check(self) || !(PyMethod_Check(meth) || PyFunction_Check(meth))) { @@ -127,7 +128,7 @@ PyObject *pyext::pyext_unbind(PyObject *,PyObject *args) } -V pyext::ClearBinding() +void pyext::ClearBinding() { // in case the object couldn't be constructed... if(!pyobj) return; -- cgit v1.2.1