大网数据广告活动
Windows 系统接口

Data-Pull Model and Data-Push Model

· 52CE 我爱测

Data-Pull Model and Data-Push Model

A client of an asynchronous moniker can choose between a data-pull and data-push model for driving an asynchronous IMoniker::BindToStorage operation and receiving asynchronous notifications. In the data-pull model, the client drives the bind operation and the moniker provides data to the client only as it is read. In other words, after the first call to IBindStatusCallback::OnDataAvailable, the moniker does not provide any data to the client unless the client has consumed all of the data that is already available.

Because data is downloaded only as it is requested, clients that choose the data-pull model must make sure to read this data in a timely manner. In the case of Internet downloads with URL monikers, the bind operation may fail if a client waits too long before requesting more data.

In the data-push model, the moniker drives the asynchronous bind operation and continuously notifies the client whenever new data is available. The client may choose whether to read the data at any point during the bind operation, but the moniker will drive the bind operation to completion regardless.

Also, you need to remember to follow the COM rules for memory allocation when using asynchronous monikers, specifically the following:

  • Whenever a COM interface or function call returns a buffer (string or other) to its client, the client is responsible for freeing the memory by calling CoTaskMemFree.
  • Whenever a COM interface or function requires a buffer from its client, the client must allocate that buffer using CoTaskMemAlloc and the callee must free it.

Be sure to follow these rules when allocating strings or buffers that are passed to asynchronous monikers, and remember to free memory returned by asynchronous monikers. See Managing Memory Allocation and related topics for complete details.

Related topics

Asynchronous Monikers

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。