threads - was:Is there a way to protect a piece of critical code?

Ray Schumacher subscriber100 at rjs.org
Fri Jan 12 11:03:29 EST 2007


"Hendrik van Rooyen" wrote:
 > Similarly discrete background thread jobs can be used
 > in a functional style this way:
 >  http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/491280
 > ( an alternative for the laborious OO-centric threading.

With the various options available, many of which I haven't used 
(CallQueue for example), I am wondering what the "best" methodology 
to use is for a 2-task example on a dual core processor for my next project:

-One task is an ADC data collection/device driver whose sole job in 
life is to fill a numpy "circular buffer" with data from an external 
ADC device at high speed and expose a pointer - programmatically 
complex but functionally distinct from the analysis task. It is I/O 
bound and spends time waiting on the ADC.
-The main task is analysis of that data in near-real time with FFT, 
correlations etc, and computationally bound. It needs to have read 
access to the array and a pointer, and kill the ADC task when desired.

Thoughts/opinions are humbly requested,
Ray




More information about the Python-list mailing list