共用方式為


ThreadPoolBoundHandle.AllocateNativeOverlapped 方法

定義

傳回 NativeOverlapped 結構的 Unmanaged 指標。

多載

AllocateNativeOverlapped(PreAllocatedOverlapped)

傳回 NativeOverlapped 結構的 Unmanaged 指標,此結構使用回呼狀態以及與指定 PreAllocatedOverlapped 物件建立關聯的緩衝區。

AllocateNativeOverlapped(IOCompletionCallback, Object, Object)

傳回 NativeOverlapped 結構的 Unmanaged 指標,指定於非同步 I/O 作業完成時叫用的委派、提供內容的使用者提供物件,以及作為緩衝區的 Managed 物件。

AllocateNativeOverlapped(PreAllocatedOverlapped)

來源:
ThreadPoolBoundHandle.cs
來源:
ThreadPoolBoundHandle.Unix.cs
來源:
ThreadPoolBoundHandle.Unix.cs

重要

此 API 不符合 CLS 規範。

傳回 NativeOverlapped 結構的 Unmanaged 指標,此結構使用回呼狀態以及與指定 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 結構的 Unmanaged 指標。

屬性

例外狀況

preAllocatednull

另一個 I/O 作業目前正在使用 preAllocated

處置 ThreadPoolBoundHandle 後才呼叫這個方法。

-或-

處置 preAllocated 後才呼叫這個方法。

備註

此方法傳回的 Unmanaged 指標可以傳遞至重迭 I/O 作業中的作業系統。 結構 NativeOverlapped 固定在實體記憶體中,直到 FreeNativeOverlapped 呼叫 方法為止。

另請參閱

適用於

AllocateNativeOverlapped(IOCompletionCallback, Object, Object)

來源:
ThreadPoolBoundHandle.cs
來源:
ThreadPoolBoundHandle.Unix.cs
來源:
ThreadPoolBoundHandle.Unix.cs

重要

此 API 不符合 CLS 規範。

傳回 NativeOverlapped 結構的 Unmanaged 指標,指定於非同步 I/O 作業完成時叫用的委派、提供內容的使用者提供物件,以及作為緩衝區的 Managed 物件。

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 結構的 Unmanaged 指標。

屬性

例外狀況

callbacknull

處置 ThreadPoolBoundHandle 物件後才呼叫這個方法。

備註

此方法傳回的 Unmanaged 指標可以傳遞至重迭 I/O 作業中的作業系統。 結構 NativeOverlapped 固定在實體記憶體中,直到 ThreadPoolBoundHandle.FreeNativeOverlapped 呼叫為止。

注意

中指定的 pinData 緩衝區會固定在 I/O 作業的持續時間內。

中指定的 pinData 緩衝區或緩衝區必須與傳遞至執行非同步 I/O 之 Unmanaged 作業系統函式的緩衝區相同。

適用於