[C++-sig] Make threading support official
troy d. straszheim
troy at resophonic.com
Sun Apr 11 05:42:06 CEST 2010
troy d. straszheim wrote:
>
> Take function new_class(...) in src/object.cpp: this is called during
> BOOST_PYTHON_MODULE(), and invoke.hpp doesn't know about it, therefore
> nothing would be locked.
>
Maybe this is a more practical example:
void set_foo_attr(object& obj, object& what)
{
api::setattr(obj, "foo", what); // leave cpp in here, no unlock
}
BOOST_PYTHON_MODULE(m)
{
def("set_foo_attr", &set_foo_attr);
}
>>> class X: pass
>>> x = X()
>>> set_foo_attr(x, ['something'])
>>> print x.foo
['something']
Here, enter/exitCPP would be called by invoke.hpp when set_foo_attr
fires, but not when api::setattr calls PyObject_SetAttrString.
-t
More information about the Cplusplus-sig
mailing list