The design uses a data cache and a pool of worker threads. There are three main
stages to the process, which are discussed below.
Stage 1: Initiation
-
Excel tries to calculate the value of a cell by calling the add-in function.
-
The add-in function looks in the cache, to see if the result is available, and
it is not. So it passes the calculation to a worker thread.
-
The add-in function immediately returns a place-holder result, e.g. "#WAIT!".
Stage 2: Calculation
-
The worker thread completes its calculation, and puts the results into the
cache.
-
The worker thread sends a signal to Excel, informing it that new data is
available for the cell containing the add-in function. (This is done by making
use of Excel's RTD mechanism.)
Stage 3: Update
-
Excel calls the add-in function again.
-
The add-in function looks in the cache and finds the desired result.
-
The add-in function returns the result to Excel, and the calling cell will now
display the result.
Next: ThreadManager class >>