XLL+ Class Library

Flow

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

  1. Excel tries to calculate the value of a cell by calling the add-in function.
  2. 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.
  3. The add-in function immediately returns a place-holder result, e.g. "#WAIT!".

Stage 2: Calculation

  1. The worker thread completes its calculation, and puts the results into the cache.
  2. 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

  1. Excel calls the add-in function again.
  2. The add-in function looks in the cache and finds the desired result.
  3. The add-in function returns the result to Excel, and the calling cell will now display the result.

Next: ThreadManager class >>