Hey Raphael
Sure, I even tried the most basic of scripts, like:
class TestThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
info("test thread instantiated")
def run(self):
info("test thread main code running")
testThread = TestThread()
t.start()
class IvrDialog(IvrDialogBase):
...
...
The debug says the following:
(4362) INFO: Ivr-Python: test thread instantiated
Fatal Python error: PyEval_AcquireThread: non-NULL old thread state
Fatal Python error: ceval: tstate mix-up
Abort (core dumped)
On Wed, Jul 9, 2008 at 9:25 AM, Raphael Coeffic <[EMAIL PROTECTED]> wrote:
> Jason Penton wrote:
>
>> Hey Stefan
>>
>> On Tue, Jul 8, 2008 at 5:09 PM, Stefan Sayer <[EMAIL PROTECTED]<mailto:
>> [EMAIL PROTECTED]>> wrote:
>>
>>
>>
>> o Jason Penton [07/08/08 16:38]:
>>
>> Hi Raphael,
>>
>> I already tried using the threading modules of python, but get
>> awesome core dumps :D
>>
>> i am not sure i tried this, but it might have to do with the
>> global interpreter lock.
>>
>>
>>
> This is indeed very strange, as i tried that a few weeks ago, and
> everything worked like a charm... Could you give an example of a script
> generating such a core dump?
>
> -Raphael.
>
>
>> I'm assuming that this is because the interpreter within C
>> doesnt actually know about this thread and probably why Stefan
>> created the createThread method?
>>
>> Stefan, any ideas?
>>
>> i was using this code:
>> server = MonitServer((monit_server, monit_port))
>>
>>
>> class MonitServer(SimpleXMLRPCServer):
>> def _dispatch(self, method, params):
>> try:
>> func = getattr(self, 'export_' + method)
>> except AttributeError:
>> raise Exception('method "%s" is not
>> supported' % method)
>> else:
>> return func(*params)
>> ###### exported functions:
>> def export_ping(self):
>> return [1]
>>
>> ...
>>
>> class run_obj:
>> def onRegistrationEvent(self, ev_type, handle, code, reason):
>> debug('onRegistrationEvent: '+ str(ev_type) + ' ' +
>> handle + ' '+ str(code) + ' ' + reason)
>>
>> server.report_registrationevent(ev_type, handle,
>> code, reason)
>>
>> def run(self):
>> debug("run_srv -- svc_monit starting XMLRPC server
>> at "+monit_server+":"+ str(monit_port))
>> server.serve_forever()
>>
>> t = run_obj()
>> ivr.createThread(t)
>> debug("svc_monit started!")
>>
>>
>> I have very similar code to this but the run method never seems to be
>> executed not even the debug statement. Output looks as follows:
>>
>>
>> (12633) DEBUG: run (Ivr.cpp:193): PythonScriptThread - calling python
>> function.
>> (12633) DEBUG: run (Ivr.cpp:195): PythonScriptThread - thread finished..
>>
>> i.e. i am assuming my debug statement should have been printed between the
>> above 2 calls.
>>
>> I had a quick look at Ivr.cpp and it seems that the createThread function
>> accepts a tuple. Is it possible that there has been a code change since you
>> last used your thread code. Im stumped at the moment?
>>
>> Cheers
>> Jason
>>
>>
>>
>>
>>
>> to run an xmlrpc server that would report some things about ivr
>> sessions (which call e.g. the onRegistrationEvent function). no
>> idea why i had to use the extra run_obj object, but probably
>> because of the run() function.
>>
>> Stefan
>>
>>
>> cheers
>> Jason
>>
>>
>> On Tue, Jul 8, 2008 at 4:25 PM, Raphael Coeffic <[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED]
>>
>> <mailto:[EMAIL PROTECTED]>>> wrote:
>>
>>
>> Hi Jason,
>>
>> i must confess that i have no idea what the createThread
>> function is
>> for (we should ask Stefan, as he added this function). The only
>> thing which i know for sure is that those threads are only
>> started
>> on start up (onLoad function of the IVR factory...).
>>
>>
>> But you can use just plain normal python threads. For this,
>> have a
>> look at:
>> http://docs.python.org/lib/module-threading.html
>> http://docs.python.org/lib/module-thread.html
>>
>> Cheers
>> Raphael.
>>
>> Jason Penton wrote:
>>
>> Hi *
>>
>> can somebody give me a heads up on creating a thread in
>> python
>> app for SEMS
>>
>> I have the following:
>>
>> class TestThread:
>> def run(self):
>> info("test thread executing")
>>
>>
>> #create test thread
>> testThread = TestThread()
>> createThread(testThread)
>>
>> the problem is that the it seems the thread never
>> executes the
>> code???????
>>
>> cheers
>> Jason
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Semsdev mailing list
>> [email protected]
>> <mailto:[email protected]>
>> <mailto:[email protected] <mailto:[email protected]>>
>>
>> http://lists.iptel.org/mailman/listinfo/semsdev
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Semsdev mailing list
>> [email protected] <mailto:[email protected]>
>> http://lists.iptel.org/mailman/listinfo/semsdev
>>
>>
>> -- Stefan Sayer
>> VoIP Services
>>
>> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>> www.iptego.com <http://www.iptego.com>
>>
>> iptego GmbH
>> Am Borsigturm 40
>> 13507 Berlin
>> Germany
>>
>> Amtsgericht Charlottenburg, HRB 101010
>> Geschaeftsfuehrer: Alexander Hoffmann
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Semsdev mailing list
>> [email protected]
>> http://lists.iptel.org/mailman/listinfo/semsdev
>>
>>
>
>
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev