ThreadPoolBoundHandle.AllocateNativeOverlapped 方法

定义

返回一个指向 NativeOverlapped 结构的非托管指针。

重载

AllocateNativeOverlapped(PreAllocatedOverlapped)

返回指向 NativeOverlapped 结构的非托管指针,该结构使用与指定 PreAllocatedOverlapped 对象关联的回调状态和缓冲区。

AllocateNativeOverlapped(IOCompletionCallback, Object, Object)

NativeOverlapped 结构返回一个非托管指针,指定在异步 I/O 操作完成时调用的委托、可提供上下文的用户提供的对象,以及充当缓冲区的托管对象。

AllocateNativeOverlapped(PreAllocatedOverlapped)

重要

此 API 不符合 CLS。

返回指向 NativeOverlapped 结构的非托管指针,该结构使用与指定 PreAllocatedOverlapped 对象关联的回调状态和缓冲区。

public:
 System::Threading::NativeOverlapped* AllocateNativeOverlapped(System::Threading::PreAllocatedOverlapped ^ preAllocated);
[System.CLSCompliant(false)]
public System.Threading.NativeOverlapped* AllocateNativeOverlapped (System.Threading.PreAllocatedOverlapped preAllocated);
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
public System.Threading.NativeOverlapped* AllocateNativeOverlapped (System.Threading.PreAllocatedOverlapped preAllocated);
[<System.CLSCompliant(false)>]
member this.AllocateNativeOverlapped : System.Threading.PreAllocatedOverlapped -> nativeptr<System.Threading.NativeOverlapped>
[<System.CLSCompliant(false)>]
[<System.Security.SecurityCritical>]
member this.AllocateNativeOverlapped : System.Threading.PreAllocatedOverlapped -> nativeptr<System.Threading.NativeOverlapped>

参数

preAllocated
PreAllocatedOverlapped

要从其中创建 NativeOverlapped 指针的对象。

返回

NativeOverlapped*

一个指向 NativeOverlapped 结构的非托管指针。

属性

例外

preAllocatednull

另一 I/O 操作当前正在使用 preAllocated

此释放 ThreadPoolBoundHandle 后调用此方法。

  • 或 - 在释放 preAllocated 后调用此方法。

注解

此方法返回的非托管指针可以通过重叠的 I/O 操作传递到操作系统。 在调用方法之前FreeNativeOverlapped,结构NativeOverlapped在物理内存中固定。

另请参阅

适用于

AllocateNativeOverlapped(IOCompletionCallback, Object, Object)

重要

此 API 不符合 CLS。

NativeOverlapped 结构返回一个非托管指针,指定在异步 I/O 操作完成时调用的委托、可提供上下文的用户提供的对象,以及充当缓冲区的托管对象。

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

参数

callback
IOCompletionCallback

一个委托,表示在异步 I/O 操作完成时调用的回调方法。

state
Object

用户提供的对象,用于区分此 NativeOverlapped 实例与其他 NativeOverlapped 实例。

pinData
Object

一个对象或对象数组,用于表示操作的输入和输出缓冲区,或者表示 null。 每个对象(如字节数组)表示一个缓冲区。

返回

NativeOverlapped*

一个指向 NativeOverlapped 结构的非托管指针。

属性

例外

callbacknull

在释放 ThreadPoolBoundHandle 对象后调用此方法。

注解

此方法返回的非托管指针可以通过重叠的 I/O 操作传递到操作系统。 结构 NativeOverlapped 在物理内存中固定,直到 ThreadPoolBoundHandle.FreeNativeOverlapped 调用为止。

备注

在 I/O 操作期间固定指定的 pinData 缓冲区。

指定的 pinData 缓冲区或缓冲区必须与传递给执行异步 I/O 的非托管操作系统函数的缓冲区相同。

适用于