[PD] object using a thread?
olaf.matthes at gmx.de
Sun Aug 28 18:49:33 CEST 2005
Christian Klippel wrote:
> after all, i dont need any lock.
> the thread only reads the usb bus with a really high timeout value.
> it then fills one side of a double_buffer, while the other side is read by the
> metro-like tick in the ps object.
> if that reading buffer is empty, the thread will switch the buffers, thats
> all. no pd functions involved in the thread.
But you still need locks! When you write data to a buffer you should
lock the buffer (or if there are two of them, lock the variable that
indicates which one is currently used). Also do so when reading from the
buffer, or you'll get sooner or later hard to reproduce crashes...
More information about the Pd-list