0 Replies Latest reply on Jul 26, 2012 12:21 AM by robblau

    PlugPlug behavior in a multi-threaded plugin


      Are there any details available on when the PlugPlug library delivers messages, and how it behaves in a multi-threaded environment?


      I'm trying to use the events as a bridge between c++ and flex, to let c++ have access to the photoshop API through the csaw library, but rather than simply exposing events, I was hoping to wrap the api with request/response event pairs used to query the flex api and then return the results, but make the whole thing look syncronous from the outside.  Basically:


      - in c++ register an event handler

      - in the c++ event handler, send another message to flex to introspect on the photoshop Application singleton

      - from flex send an event back with the details being requested

      - in another c++ event handler use that information


      As a congrete example, lets say that I want the string for photoshop's version in c++ (by going through flex).


      - From flex I send a 'launchCommand' event

      - In c++'s launchCommand handler I create an event along the lines of <request>version</request> and dispatch it

      - In flex I get that event, parse it and create a response event along the lines of <response>13.0</response>

      - In c++ I parse that response and use the information


      I've been running into a whole bunch of roadblocks with this approach.  It looks like you can dispatch an event from an event handler, but it doesn't actually make it to flex until the event handler returns.  Also, it looks like if you dispatch from a thread other than the main thread it doesn't make it to flex at all.  Is that right, or is the behavior something else?


      Thanks for the help!