Place for notes on GpgOL development. Outlook API information and other stuff.
Busy wait / blocking the main thread for crypto results
As of GpgOL 1.2.1 we have the problem that we need to get the results of a Crypto operation before continuing.
This is currently implemented as a Busy wait in engine_wait. This is bad both because it is busy (resulting in outlook showing as 100% cpu usage) and because it is wait (Outlook is not responding).
The Problem is that the Outlook Object Model can only be accessed by the main outlook thread. So we can't just put the crypto actions in a thread and be done with it.
To fix this I think we need to obtain all necessary data from the OOM, then put the crypo action in a thread with this information and let it run. We also need to put information what to do with the result (how to find the relevant elements in the OOM) in this thread. After the thread is finished it needs to Send a Message (SendMessage) to Outlook with a custom message ID that we can register GpgOL to handle. The message is then handled in the main thread again. We could obtain the relevant objects in the OOM again and show the result. This would enable us to run actions asynchronusly without violating the OOM constraints.