ThreadPoolBoundHandle.AllocateNativeOverlapped 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回 NativeOverlapped 結構的 Unmanaged 指標。
多載
AllocateNativeOverlapped(PreAllocatedOverlapped) |
傳回 NativeOverlapped 結構的 Unmanaged 指標,此結構使用回呼狀態以及與指定 PreAllocatedOverlapped 物件建立關聯的緩衝區。 |
AllocateNativeOverlapped(IOCompletionCallback, Object, Object) |
傳回 NativeOverlapped 結構的 Unmanaged 指標,指定於非同步 I/O 作業完成時叫用的委派、提供內容的使用者提供物件,以及作為緩衝區的 Managed 物件。 |
AllocateNativeOverlapped(PreAllocatedOverlapped)
重要
此 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 指標。
- 屬性
例外狀況
preAllocated
為 null
。
另一個 I/O 作業目前正在使用 preAllocated
。
備註
此方法傳回的 Unmanaged 指標可以傳遞至重迭 I/O 作業中的作業系統。 結構 NativeOverlapped 固定在實體記憶體中,直到 FreeNativeOverlapped 呼叫 方法為止。
另請參閱
適用於
AllocateNativeOverlapped(IOCompletionCallback, Object, Object)
重要
此 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 指標。
- 屬性
例外狀況
callback
為 null
。
處置 ThreadPoolBoundHandle 物件後才呼叫這個方法。
備註
此方法傳回的 Unmanaged 指標可以傳遞至重迭 I/O 作業中的作業系統。 結構 NativeOverlapped 固定在實體記憶體中,直到 ThreadPoolBoundHandle.FreeNativeOverlapped 呼叫為止。
注意
中指定的 pinData
緩衝區會固定在 I/O 作業的持續時間內。
中指定的 pinData
緩衝區或緩衝區必須與傳遞至執行非同步 I/O 之 Unmanaged 作業系統函式的緩衝區相同。