Sturla Molden wrote: > Dag Sverre Seljebotn skrev: >> cdef extern from *: >> ctypedef int vint "volatile int" >> >> What you said is: typedef "int" as "vint" Cython-side and "volatile int" >> C-side. >> >> > > Right... I see that it works :-) > > Hm... that remids me: should we add a "volatile" keyword to the buffer > constructor as well? It would work like "readonly", except that the > content of the buffer is declared volatile. > > Volatile is useful if the buffer is filled with data from some hardware > interrupt. Volatile is also be useful when multiple threads are reading > and writing to the same buffer. > > I have use for this when reading 16 bit data from an array of 32 ADCs, > sampling at 48 kHz: > > cdef np.ndarray[np.int16_t, ndim=2, mode="c", volatile=True] adc_buffer > > adc_buffer = np.zeros((48000,32), dtype=np.int16) # filled from > hardware interrupt > # once every second
If you a real usecase for it (as it seems that you do), I'll accept a patch. -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
