Share via


INDAdapter::CreateMemoryWindow Method

Creates an uninitialized memory window.

Syntax

HRESULT CreateMemoryWindow(
  [in]   ND_RESULT *pInvalidateResult,
  [out]  INDMemoryWindow **ppMw
);

Parameters

  • pInvalidateResult [in]
    An ND_RESULT structure that is used when the remote peer sends a SendAndInvalidate request.

  • ppMw [out]
    An INDMemoryWindow interface.

Return Value

When you implement this method, you should return the following return values. If you return others, try to use well-known values to aid in debugging issues.

Return code Description
ND_SUCCESS

The operation completed successfully.

ND_INSUFFICIENT_RESOURCES

There was not enough hardware resources to create the memory window.

ND_DEVICE_REMOVED

The underlying Network Direct adapter was removed from the system. Only cleanup operations on the Network Direct adapter will succeed.

 

Remarks

You need to create a memory window and bind it to registered memory only if the connected peer is going to perform Read and Write operations. The side issuing the Read and Write requests does not create the memory window.

The memory window is initialized and becomes valid when you bind it to registered memory. To bind the window to registered memory, call the INDEndpoint::Bind method. The window can be bound to only a single endpoint at one time. However, the window could be bound to a different endpoint after being invalidated.

To invalidate the window locally, call the INDEndpoint::Invalidate method. You should not invalidate the window unless you receive a message from the connected peer indicating that they are done with the window. Typically, the connected peer calls the INDEndpoint::SendAndInvalidate method to indicate that they are done with the window and to invalidate the window. If the connected peer calls the SendAndInvalidate method, do not call the Invalidate method.

Note that there could be a race between a local call to INDEndpoint::Invalidate and a receiving a SendAndInvalidate request from a remote peer. One of the operations will succeed, and the other will fail. The failure will cause the connection to be terminated. Your protocol should define how memory windows get unbound to avoid such issues.

If your protocol determines that the peer will call the SendAndInvalidate method, you must call the INDEndpoint::Receive method before the peer issues the SendAndInvalidate request. (The Receive request is posted to receive the send data from the send portion of the SendAndInvalidate request.) When the SendAndInvalidate request completes, your inbound completion queue will contain the invalidate results followed by the receive results.

You must keep the pInvalidateResult variable valid until the invalidate portion completes or you call the INDEndpoint::Invalidate method.

Requirements

Product

Microsoft Message Passing Interface (MS-MPI)

Header

Ndspi.h

See Also

INDAdapter

 

 

Send comments about this topic to Microsoft

Build date: 7/2/2010