ApplicationCommandManager::invoke (asynchronous)


#1

Hi,

I don’t understand the jassert in this method (ApplicationCommandManager::invoke), when using asynchronous invocation.
I perfectly understand that while asking synchronous invokation, the message manager must be locked, but not the opposite.
I’m probably misunderstanding “asynchronous”. I understand it as “queue the invocation, and do it whenever you can”.
In that case, why should the message manager be locked ?

It’s totally possible for me to lock the message manager, but I was wondering why the method requires this.


#2

It’s async in the sense that it queues the request and returns, but that’s not the same thing as being thread-safe. Before it can create its request it has to do a bunch of preparation work that requires locking.


#3

Ok, that’s what I thought at first. For people searching the forum, there is ActionListener than can be used if you can’t lock the MM.