Re: [C++-sig] boost::python and threads

2009-07-09 Thread Paul Scruby
t;>> thread_locker() >>> { >>> if (thread_support::enabled()) >>> m_gstate = PyGILState_Ensure(); >>> } >>> >>> ~thread_locker() >>> { >>> if (thread_support::enabled()) >>> PyGILState_Release(m_gstate); >>> }

Re: [C++-sig] boost::python and threads

2009-07-08 Thread Renato Araujo
>> } >>> >>> ~thread_locker() >>> { >>> if (thread_support::enabled()) >>> PyGILState_Release(m_gstate); >>> } >>> }; >>> >>> then in my wrapper virtual implementation I did this: >>> >>> ... >

Re: [C++-sig] boost::python and threads

2009-07-08 Thread Paul Scruby
iam Ladwig wrote: >>> Whoops, I think this problem is a little uglier than I thought, since >>> you >>> overrode the onTick() function in python with a call to print, which >>> needs access to the interpreter in your new thread. See the link Thomas >>> p

Re: [C++-sig] boost::python and threads

2009-07-06 Thread Renato Araujo
illiam Ladwig wrote: >>> Whoops, I think this problem is a little uglier than I thought, since you >>> overrode the onTick() function in python with a call to print, which >>> needs access to the interpreter in your new thread. See the link Thomas >>> posted f

Re: [C++-sig] boost::python and threads

2009-07-06 Thread Paul Scruby
rying about any possible >> garbage collection issues). Now I remember why I kept my C++ threads >> isolated from Python stuffsorry, it's been a while >> >> Bill >> ____________________ >> From: cplusplus-sig-bounces+wladwig=wdtin

Re: [C++-sig] boost::python and threads

2009-07-06 Thread Paul Scruby
bounces+wladwig=wdtinc@python.org > [cplusplus-sig-bounces+wladwig=wdtinc@python.org] On Behalf Of William > Ladwig [wlad...@wdtinc.com] > Sent: Saturday, July 04, 2009 1:34 PM > To: Development of Python/C++ integration > Subject: Re: [C++-sig] boost::python and threads > >

Re: [C++-sig] boost::python and threads

2009-07-04 Thread Renato Araujo
adwig=wdtinc@python.org] On Behalf Of William > Ladwig [wlad...@wdtinc.com] > Sent: Saturday, July 04, 2009 1:34 PM > To: Development of Python/C++ integration > Subject: Re: [C++-sig] boost::python and threads > > It looks to me like you have a garbage collection problem go

Re: [C++-sig] boost::python and threads

2009-07-04 Thread William Ladwig
lf Of William Ladwig [wlad...@wdtinc.com] Sent: Saturday, July 04, 2009 1:34 PM To: Development of Python/C++ integration Subject: Re: [C++-sig] boost::python and threads It looks to me like you have a garbage collection problem going on. If you create a wrapped c++ object in python, then pyth

Re: [C++-sig] boost::python and threads

2009-07-04 Thread William Ladwig
It looks to me like you have a garbage collection problem going on. If you create a wrapped c++ object in python, then python is going to own the object and will destroy it when its reference count goes to 0. In your python example script at the bottom, you call the Ticker's run() function, wh

Re: [C++-sig] boost::python and threads

2009-07-04 Thread Thomas Berg
Hi, On Fri, Jul 3, 2009 at 1:15 PM, Paul Scruby wrote: > I am having some problems using boost::python with boost::thread.  I'm using > threads because I want to run some tasks in the background when I'm using > the Python's interactive shell.  However, when I use get_override() to call > a Python