本文整理汇总了C#中IOCompletionCallback类的典型用法代码示例。如果您正苦于以下问题:C# IOCompletionCallback类的具体用法?C# IOCompletionCallback怎么用?C# IOCompletionCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IOCompletionCallback类属于命名空间,在下文中一共展示了IOCompletionCallback类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: _IOCompletionCallback
internal _IOCompletionCallback(IOCompletionCallback ioCompletionCallback, ref StackCrawlMark stackMark)
{
_ioCompletionCallback = ioCompletionCallback;
// clone the exection context
_executionContext = ExecutionContext.Capture(ref stackMark);
ExecutionContext.ClearSyncContext(_executionContext);
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:7,代码来源:overlapped.cs
示例2: PreAllocatedOverlapped
public unsafe PreAllocatedOverlapped(IOCompletionCallback callback, object state, object pinData)
{
if (callback == null)
throw new ArgumentNullException(nameof(callback));
_overlapped = Win32ThreadPoolNativeOverlapped.Allocate(callback, state, pinData, this);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:7,代码来源:Win32ThreadPoolPreAllocatedOverlapped.cs
示例3: OverlappedCache
internal unsafe OverlappedCache(Overlapped overlapped, object pinnedObjects, IOCompletionCallback callback, bool alreadyTriedCast)
{
this.m_Overlapped = overlapped;
this.m_PinnedObjects = pinnedObjects;
this.m_PinnedObjectsArray = (alreadyTriedCast ? null : new object[0]);
this.m_NativeOverlapped = new SafeNativeOverlapped((IntPtr)((void*)overlapped.UnsafePack(callback, pinnedObjects)));
}
开发者ID:BjkGkh,项目名称:R106,代码行数:7,代码来源:OverlappedCache.cs
示例4: PreAllocatedOverlapped
public unsafe PreAllocatedOverlapped(IOCompletionCallback callback, object state, object pinData)
{
if (callback == null)
throw new ArgumentNullException("callback");
_overlapped = new ThreadPoolBoundHandleOverlapped(callback, state, pinData, this);
}
开发者ID:noahfalk,项目名称:corefx,代码行数:7,代码来源:ClrThreadPoolPreAllocatedOverlapped.cs
示例5: OverlappedContext
public OverlappedContext()
{
if (OverlappedContext.completeCallback == null)
{
OverlappedContext.completeCallback = Fx.ThunkCallback(new IOCompletionCallback(CompleteCallback));
}
if (OverlappedContext.eventCallback == null)
{
OverlappedContext.eventCallback = Fx.ThunkCallback(new WaitOrTimerCallback(EventCallback));
}
if (OverlappedContext.cleanupCallback == null)
{
OverlappedContext.cleanupCallback = Fx.ThunkCallback(new WaitOrTimerCallback(CleanupCallback));
}
this.bufferHolder = new object[] { OverlappedContext.dummyBuffer };
this.overlapped = new Overlapped();
this.nativeOverlapped = this.overlapped.UnsafePack(OverlappedContext.completeCallback, this.bufferHolder);
// When replacing the buffer, we need to provoke the CLR to fix up the handle of the pin.
this.pinnedHandle = GCHandle.FromIntPtr(*((IntPtr*)nativeOverlapped +
(IntPtr.Size == 4 ? HandleOffsetFromOverlapped32 : HandleOffsetFromOverlapped64)));
this.pinnedTarget = this.pinnedHandle.Target;
// Create the permanently rooted holder and put it in the Overlapped.
this.rootedHolder = new RootedHolder();
this.overlapped.AsyncResult = rootedHolder;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:28,代码来源:OverlappedContext.cs
示例6: OverlappedCache
internal OverlappedCache(System.Threading.Overlapped overlapped, object pinnedObjects, IOCompletionCallback callback, bool alreadyTriedCast)
{
this.m_Overlapped = overlapped;
this.m_PinnedObjects = pinnedObjects;
this.m_PinnedObjectsArray = alreadyTriedCast ? null : NclConstants.EmptyObjectArray;
this.m_NativeOverlapped = new SafeNativeOverlapped(overlapped.UnsafePack(callback, pinnedObjects));
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:OverlappedCache.cs
示例7: Pack
internal unsafe NativeOverlapped* Pack(IOCompletionCallback iocb, object userData)
{
if (!this.m_pinSelf.IsNull())
{
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_Overlapped_Pack"));
}
StackCrawlMark lookForMyCaller = StackCrawlMark.LookForMyCaller;
if (iocb != null)
{
this.m_iocbHelper = new _IOCompletionCallback(iocb, ref lookForMyCaller);
this.m_iocb = iocb;
}
else
{
this.m_iocbHelper = null;
this.m_iocb = null;
}
this.m_userObject = userData;
if (this.m_userObject != null)
{
if (this.m_userObject.GetType() == typeof(object[]))
{
this.m_isArray = 1;
}
else
{
this.m_isArray = 0;
}
}
return this.AllocateNativeOverlapped();
}
开发者ID:randomize,项目名称:VimConfig,代码行数:31,代码来源:OverlappedData.cs
示例8: _IOCompletionCallback
internal _IOCompletionCallback(IOCompletionCallback ioCompletionCallback, ref StackCrawlMark stackMark)
{
_ioCompletionCallback = ioCompletionCallback;
// clone the exection context
_executionContext = ExecutionContext.Capture(
ref stackMark,
ExecutionContext.CaptureOptions.IgnoreSyncCtx | ExecutionContext.CaptureOptions.OptimizeDefaultCase);
}
开发者ID:kouvel,项目名称:coreclr,代码行数:8,代码来源:Overlapped.cs
示例9: ThreadPoolBoundHandleOverlapped
public unsafe ThreadPoolBoundHandleOverlapped(IOCompletionCallback callback, object state, object pinData, PreAllocatedOverlapped preAllocated)
{
_userCallback = callback;
_userState = state;
_preAllocated = preAllocated;
_nativeOverlapped = Pack(CompletionCallback, pinData);
_nativeOverlapped->OffsetLow = 0; // CLR reuses NativeOverlapped instances and does not reset these
_nativeOverlapped->OffsetHigh = 0;
}
开发者ID:Rayislandstyle,项目名称:corefx,代码行数:10,代码来源:ClrThreadPoolBoundHandleOverlapped.cs
示例10: Allocate
internal unsafe static Win32ThreadPoolNativeOverlapped* Allocate(IOCompletionCallback callback, object state, object pinData, PreAllocatedOverlapped preAllocated)
{
Win32ThreadPoolNativeOverlapped* overlapped = AllocateNew();
try
{
overlapped->SetData(callback, state, pinData, preAllocated);
}
catch
{
Free(overlapped);
throw;
}
return overlapped;
}
开发者ID:GeneralRookie,项目名称:corefx,代码行数:14,代码来源:Win32ThreadPoolNativeOverlapped.cs
示例11: PipeServiceListener
static unsafe PipeServiceListener()
{
pipeStreamType = typeof(System.IO.Pipes.PipeStream);
FieldInfo ioCallbackField = pipeStreamType.GetField("IOCallback", BindingFlags.GetField | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.IgnoreReturn);
pipeStreamAsyncPSCallback = (IOCompletionCallback)ioCallbackField.GetValue(null);
ioCallbackField.SetValue(null, new IOCompletionCallback(pipeStreamAsyncPSCallbackWrapper));
// 修正 WaitForConnection 的回调函数中的异常
pipeServerStreamType = typeof(System.IO.Pipes.NamedPipeServerStream);
ioCallbackField = pipeServerStreamType.GetField("WaitForConnectionCallback", BindingFlags.GetField | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.IgnoreReturn);
pSSAsyncWaitForConnectionCallback = (IOCompletionCallback)ioCallbackField.GetValue(null);
ioCallbackField.SetValue(null, new IOCompletionCallback(pSSAsyncWaitForConnectionCallbackWrapper));
}
开发者ID:Kjubo,项目名称:xms.core,代码行数:19,代码来源:PipeServiceListener.cs
示例12: AllocateNativeOverlapped
public unsafe NativeOverlapped* AllocateNativeOverlapped(IOCompletionCallback callback, object state, object pinData)
{
if (callback == null)
throw new ArgumentNullException("callback");
AddRef();
try
{
Win32ThreadPoolNativeOverlapped* overlapped = Win32ThreadPoolNativeOverlapped.Allocate(callback, state, pinData, preAllocated: null);
overlapped->Data._boundHandle = this;
Interop.mincore.StartThreadpoolIo(_threadPoolHandle);
return Win32ThreadPoolNativeOverlapped.ToNativeOverlapped(overlapped);
}
catch
{
Release();
throw;
}
}
开发者ID:GeneralRookie,项目名称:corefx,代码行数:21,代码来源:Win32ThreadPoolBoundHandle.cs
示例13: OverlappedContext
public unsafe OverlappedContext()
{
if (completeCallback == null)
{
completeCallback = Fx.ThunkCallback(new IOCompletionCallback(OverlappedContext.CompleteCallback));
}
if (eventCallback == null)
{
eventCallback = Fx.ThunkCallback(new WaitOrTimerCallback(OverlappedContext.EventCallback));
}
if (cleanupCallback == null)
{
cleanupCallback = Fx.ThunkCallback(new WaitOrTimerCallback(OverlappedContext.CleanupCallback));
}
this.bufferHolder = new object[] { dummyBuffer };
this.overlapped = new Overlapped();
this.nativeOverlapped = this.overlapped.UnsafePack(completeCallback, this.bufferHolder);
this.pinnedHandle = GCHandle.FromIntPtr(*((IntPtr*) (this.nativeOverlapped + (((IntPtr.Size == 4) ? -4 : -3) * sizeof(IntPtr)))));
this.pinnedTarget = this.pinnedHandle.Target;
this.rootedHolder = new RootedHolder();
this.overlapped.AsyncResult = this.rootedHolder;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:22,代码来源:OverlappedContext.cs
示例14: UnsafePack
unsafe internal NativeOverlapped* UnsafePack(IOCompletionCallback iocb, Object userData)
{
if (!m_pinSelf.IsNull()) {
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_Overlapped_Pack"));
}
m_userObject = userData;
if (m_userObject != null)
{
if (m_userObject.GetType() == typeof(Object[]))
{
m_isArray = 1;
}
else
{
m_isArray = 0;
}
}
m_iocb = iocb;
m_iocbHelper = null;
return AllocateNativeOverlapped();
}
开发者ID:kouvel,项目名称:coreclr,代码行数:21,代码来源:Overlapped.cs
示例15: BindIoCompletionCallback
public static extern bool BindIoCompletionCallback(
SafeCloseSocket socketHandle,
IOCompletionCallback function,
Int32 flags
);
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:5,代码来源:UnsafeNativeMethods.cs
示例16: Pack
public NativeOverlapped Pack (IOCompletionCallback iocb) {
return default(NativeOverlapped);
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:4,代码来源:System.Threading.Overlapped.cs
示例17:
unsafe public NativeOverlapped *Pack (IOCompletionCallback iocb)
{
NativeOverlapped *result = (NativeOverlapped *) Marshal.AllocHGlobal (Marshal.SizeOf (typeof (NativeOverlapped)));
result->OffsetLow = offsetL;
result->OffsetHigh = offsetH;
result->EventHandle = (IntPtr)evt;
return result;
}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:Overlapped.cs
示例18: Pack
unsafe public NativeOverlapped *UnsafePack (IOCompletionCallback iocb)
{
// no need to propagate the call stack in the unsafe version
return Pack (iocb);
}
开发者ID:nlhepler,项目名称:mono,代码行数:5,代码来源:Overlapped.cs
示例19: IOCompletionThunk
public IOCompletionThunk(IOCompletionCallback callback, ExceptionCallback exceptionCallback)
{
if (callback == null) throw new ArgumentNullException("callback");
if (exceptionCallback == null) throw new ArgumentNullException("exceptionCallback");
this.callback = callback;
this.exceptionCallback = exceptionCallback;
}
开发者ID:Ruudvdl,项目名称:SignalR.WindowsAzureServiceBus,代码行数:8,代码来源:SimpleIOThreadScheduler.cs
示例20: SetData
private void SetData(IOCompletionCallback callback, object state, object pinData, PreAllocatedOverlapped preAllocated)
{
Debug.Assert(callback != null);
OverlappedData data = Data;
data._callback = callback;
data._state = state;
data._executionContext = ExecutionContext.Capture();
data._preAllocated = preAllocated;
//
// pinData can be any blittable type to be pinned, *or* an instance of object[] each element of which refers to
// an instance of a blittable type to be pinned.
//
if (pinData != null)
{
object[] objArray = pinData as object[];
if (objArray != null && objArray.GetType() == typeof(object[]))
{
if (data._pinnedData == null || data._pinnedData.Length < objArray.Length)
Array.Resize(ref data._pinnedData, objArray.Length);
for (int i = 0; i < objArray.Length; i++)
{
if (!data._pinnedData[i].IsAllocated)
data._pinnedData[i] = GCHandle.Alloc(objArray[i], GCHandleType.Pinned);
else
data._pinnedData[i].Target = objArray[i];
}
}
else
{
if (data._pinnedData == null)
data._pinnedData = new GCHandle[1];
if (!data._pinnedData[0].IsAllocated)
data._pinnedData[0] = GCHandle.Alloc(pinData, GCHandleType.Pinned);
else
data._pinnedData[0].Target = pinData;
}
}
}
开发者ID:GeneralRookie,项目名称:corefx,代码行数:43,代码来源:Win32ThreadPoolNativeOverlapped.cs
注:本文中的IOCompletionCallback类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论