Control registry operations in Windows and .NET applications

Thread safety and serialization of the calls

Callback functions are always serialized when they are related to the same opened registry key. In other words, if the key has been opened twice in parallel, callbacks for the first opened handle are serialized called one by one, and so are callbacks for the second opened handle.

However if there are two pending operations for different opened handles, the callbacks can be called in two ways - either serialized (as described above) or in parallel from several different threads (the number of threads is determined by MinWorkerThreadCount and MaxWorkerThreadCount properties). The default behaviour is to call the callbacks in parallel, and this can be changed to sequential call using SerializeCallbacks property.

In any case, the callbacks are not called within context of the thread, in which the component itself was created. So you would need to synchronize the operations between the callbacks and the operations in other threads of the application.

Back to top