Multithreaded external (Win32)?

    Aug 04 2012 | 1:40 am
    I have a Max external project which connects to a Wiimote and creates a secondary thread where I attempt to update the acceleration data and output the results to an outlet during each update frame. This seems to generate an access read violation at the following line:
    outlet_anything(data->sender->m_outlet[1], gensym("accel"), 3, av);
    I implemented a critical section in hopes that it would correct the issue, but it still fails. Does anyone have a working example of a multithreaded Max object? Is multithreading even allowed?
    EDIT: Oops, I meant to post this in the Dev forum.

    • Aug 04 2012 | 3:34 am
      I figured out what I was doing wrong. I should've been using the built-in Max threading and critical functions defined in ext_systhread.h and ext_critical.h, respectively. Before, I was using CreateThread() and EnterCriticalSection()/LeaveCriticalSection() as defined in the Windows headers.