How do asynchronous actions from within a plugin?

I’m updating one of my own plugins and it needs to talk asynchronously to Azure Microsoft translate in the background.
Now it could just block while the REST API talks, but then one can queue several requests at once also so it could potentially make the user sit and wait for seconds maybe even minutes, until all the connections are done.

AFAIK the IDA execution is still single threaded in IDA 9.
Need to process these events in a separate thread(s) then as the results come in, sync up the data so it appears in an IDA chooser window.

Similarly, people that have made their own collaboration plugins must handle this problem as well.

I have an inkling it would need to be handled through a viewer callback to determine when IDA is idle so it can process these inside the IDA thread.

Looking for a preferred way, and then perhaps some alternate solutions if you have them.

There are proper threads now, see idasdk90/plugins/mtsample/mtsample.cpp. You can call execute_sync to schedule your code to the main thread and from there you can call refresh_chooser. In theory, I have not tested it.

I would suggest suggest using the waitbox API (show_wait_box() then user_cancelled() in a loop which waits for the request thread to finish). If you need to call any IDA APIs from the thread, you should use execute_sync(). See findcrypt2 and mtsample plugins in the SDK for more info.

Thanks, will try that.