Multiple Threads in the Repository Add-in
There are two situations in which the Repository Add-in can start a thread to perform some background processing against the repository. They are:
-
During initialization of Visual Basic, the Repository Add-in performs its initialization functions in a background thread.
-
The Repository Add-in uses a background thread to delete data from the repository.
By performing its initialization in a background thread, the Repository Add-in speeds the initialization of Visual Basic. Similarly, by using a background process to delete objects from the repository, the Repository Add-in ensures that lengthy delete propagation operations do not needlessly lengthen the response time of the Visual Basic interactive development environment.
You should be aware of this background processing for two reasons.
-
First, if you call the Repository Add-in during the initialization of your add-in module, you can slow down the initialization of Visual Basic. For example, if you call the Repository Add-in to retrieve the repository instance that it is using, the Repository Add-in waits until it is fully initialized before responding to your GetRepository call. If you make this call as a part of your initialization, and you initialize your add-in module in a foreground thread, the foreground processing — including the overall initialization of Visual Basic — will be delayed. You can avoid this delay by either performing your initialization in a background thread or by postponing your call to GetRepository until the last possible moment.
-
Second, you should be aware that the repository instance can occasionally reflect obsolete objects — objects whose deletion is pending in a transaction of a background thread.