Bewerken

Share via


ThreadPoolBoundHandle.UnsafeAllocateNativeOverlapped Method

Definition

Important

This API is not CLS-compliant.

Returns an unmanaged pointer to a NativeOverlapped structure, specifying a delegate that is invoked when the asynchronous I/O operation is complete, a user-provided object providing context, and managed objects that serve as buffers.

public:
 System::Threading::NativeOverlapped* UnsafeAllocateNativeOverlapped(System::Threading::IOCompletionCallback ^ callback, System::Object ^ state, System::Object ^ pinData);
[System.CLSCompliant(false)]
public System.Threading.NativeOverlapped* UnsafeAllocateNativeOverlapped (System.Threading.IOCompletionCallback callback, object? state, object? pinData);
[<System.CLSCompliant(false)>]
member this.UnsafeAllocateNativeOverlapped : System.Threading.IOCompletionCallback * obj * obj -> nativeptr<System.Threading.NativeOverlapped>

Parameters

callback
IOCompletionCallback

An IOCompletionCallback delegate that represents the callback method invoked when the asynchronous I/O operation completes.

state
Object

A user-provided object that distinguishes this NativeOverlapped from other NativeOverlapped instances. Can be null.

pinData
Object

An object or array of objects representing the input or output buffer for the operation. Each object represents a buffer, for example an array of bytes. Can be null.

Returns

An unmanaged pointer to a NativeOverlapped structure.

Attributes

Exceptions

callback is null.

This method was called after the ThreadPoolBoundHandle was disposed.

Remarks

The unmanaged pointer returned by this method can be passed to the operating system in overlapped I/O operations. The NativeOverlapped structure is fixed in physical memory until FreeNativeOverlapped(NativeOverlapped*) is called.

The buffer or buffers specified in pinData must be the same as those passed to the unmanaged operating system function that performs the asynchronous I/O.

ExecutionContext is not flowed to the invocation of the callback.

Note

The buffers specified in pinData are pinned for the duration of the I/O operation.

Applies to