Callback Synchronization

The asynchronous WinInet API (used for the most common protocols) leaves the synchronization of the callback mechanism and the calling application as an exercise for the client. This is intentional because it allows the greatest degree of flexibility. The default protocols and the URL Moniker implementation perform this synchronization and guarantee that single- and apartment-threaded applications never have to deal with free-thread-style contention. That is, the client's IEnumFORMATETC and IBindStatusCallback interfaces are called only on their proper threads. This feature is transparent to the user of the URL Moniker as long each thread that calls IMoniker::BindToStorage and IMoniker::BindToObject has a message queue.

The Asynchronous Moniker specification requires more precise control over the prioritization and management of downloads than is allowed for either by WinSock or WinInet. Accordingly, a URL Moniker manages all the downloads for any given caller's thread, using—as part of its synchronization—a priority scheme based on the IBinding specification.