Trying to understand more about potential thread-unsafeties, I have gone back to study the minimum source code in the SDK and my doubts have grown bigger.
Let’s assume that I have overdrive on.
minimum_list() is called in the main thread, with a list longer or shorter than x->m_count. minimum_resize() is called, x->m_args is freed.
Then minimum_list() is called in the high priority thread, with a list of x->m_count elements, and unfortunately the high priority thread interrupts the main thread right now, after the latter has freed x->m_args. Things are written in x->m_args+i, and we face the catastrophe!
… don’t we? what’s wrong? is it the example, or is it me? Shouldn’t there be a mutex or some other mechanism to protect the array? Or is this one of those common operations referred to in the "threading" section of the documentation? Or what else?
thanks for any enlightenment!
Thanks for catching this — you are correct that the object is not currently threadsafe. We’ll fix this for a future release.
C74 RSS Feed | © Copyright Cycling '74