Re: Delivering data to python from a c-thread

2006-11-08 Thread Svein Seldal
Steve Holden wrote: > OK. I was just thinking that, with Python threads, communication using > Queue.Queue is thread-safe and will handle the GIL, so that way you only > have the problem of how to synchronize your C code when it receives the > callback from the Python thread. The python intern

Re: Delivering data to python from a c-thread

2006-11-08 Thread Svein Seldal
Steve Holden wrote: > OK. I was just thinking that, with Python threads, communication using > Queue.Queue is thread-safe and will handle the GIL, so that way you only > have the problem of how to synchronize your C code when it receives the > callback from the Python thread. The python intern

Re: Delivering data to python from a c-thread

2006-11-08 Thread Steve Holden
Svein Seldal wrote: > Steve Holden wrote: > >> Could you have the Python code create a second Python thread and have it >> call back into the C code to collect any waiting data? > > Well yeah, in principle. However one would need some synchronization > mechanisms anyway. The C data source is ge

Re: Delivering data to python from a c-thread

2006-11-08 Thread Svein Seldal
Steve Holden wrote: > Could you have the Python code create a second Python thread and have it > call back into the C code to collect any waiting data? Well yeah, in principle. However one would need some synchronization mechanisms anyway. The C data source is generating asynch. messages to de

Re: Delivering data to python from a c-thread

2006-11-08 Thread Steve Holden
Svein Seldal wrote: > Hi, > > I have a C-application that calls a Python function main(). This > function will loop forever and not return until the entire application > is about to terminate. > > In a parallel C-thread, some data must be regularly delivered to the > running python application

Delivering data to python from a c-thread

2006-11-08 Thread Svein Seldal
Hi, I have a C-application that calls a Python function main(). This function will loop forever and not return until the entire application is about to terminate. In a parallel C-thread, some data must be regularly delivered to the running python application. My initial plan was to call a py f