当前位置: 首页>>代码示例>>C#>>正文


C# IOCompletionCallback类代码示例

本文整理汇总了C#中IOCompletionCallback的典型用法代码示例。如果您正苦于以下问题:C# IOCompletionCallback类的具体用法?C# IOCompletionCallback怎么用?C# IOCompletionCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IOCompletionCallback类属于命名空间,在下文中一共展示了IOCompletionCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的IOCompletionCallback类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。