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


C# WorkItemCallback类代码示例

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


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

示例1: CreateWorkItem

 /// <summary>
 ///   Create a new work item
 /// </summary>
 /// <param name = "wigStartInfo">Work item group start information</param>
 /// <param name = "callback">A callback to execute</param>
 /// <returns>Returns a work item</returns>
 public static WorkItem CreateWorkItem(
     IWorkItemsGroup workItemsGroup,
     WIGStartInfo wigStartInfo,
     WorkItemCallback callback)
 {
     return CreateWorkItem(workItemsGroup, wigStartInfo, callback, null);
 }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:13,代码来源:WorkItemFactory.cs

示例2: Post

 public static void Post(WorkItemCallback callback)
 {
     if (Environment.OSVersion.Platform != PlatformID.Win32NT)
     {
         throw new PlatformNotSupportedException(System.Web.SR.GetString("RequiresNT"));
     }
     PostInternal(callback);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:WorkItem.cs

示例3: Post

    public static void Post(WorkItemCallback callback) {
#if !FEATURE_PAL // ROTORTODO
        if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            throw new PlatformNotSupportedException(SR.GetString(SR.RequiresNT));
#else // !FEATURE_PAL
        throw new NotImplementedException("ROTORTODO");
#endif // !FEATURE_PAL
        PostInternal(callback);
    }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:9,代码来源:WorkItem.cs

示例4: PostInternal

 internal static void PostInternal(WorkItemCallback callback) {
     if (_useQueueUserWorkItem) {
         ThreadPool.QueueUserWorkItem(_onQueueUserWorkItemCompletion, callback);
     }
     else {
         WrappedWorkItemCallback w = new WrappedWorkItemCallback(callback);
         w.Post();
     }
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:9,代码来源:WorkItem.cs

示例5: ChainedDelegatesCallback

        public void ChainedDelegatesCallback()
        {
            SmartThreadPool stp = new SmartThreadPool();

            WorkItemCallback workItemCallback = new WorkItemCallback(DoWork);
            workItemCallback += new WorkItemCallback(DoWork);

            stp.QueueWorkItem(workItemCallback);

            stp.WaitForIdle();

            stp.Shutdown();
        }
开发者ID:jogibear9988,项目名称:smartthreadpool,代码行数:13,代码来源:TestChainedDelegates.cs

示例6: CreateWorkItem

 // Token: 0x0600185F RID: 6239
 // RVA: 0x00075274 File Offset: 0x00073474
 public static WorkItem CreateWorkItem(IWorkItemsGroup iworkItemsGroup_0, WIGStartInfo wigstartInfo_0, WorkItemCallback workItemCallback_0, object object_0, WorkItemPriority workItemPriority_0)
 {
     WorkItemFactory.ValidateCallback(workItemCallback_0);
     return new WorkItem(iworkItemsGroup_0, new WorkItemInfo
     {
         UseCallerCallContext = wigstartInfo_0.UseCallerCallContext,
         UseCallerHttpContext = wigstartInfo_0.UseCallerHttpContext,
         PostExecuteWorkItemCallback = wigstartInfo_0.PostExecuteWorkItemCallback,
         CallToPostExecute = wigstartInfo_0.CallToPostExecute,
         DisposeOfStateObjects = wigstartInfo_0.DisposeOfStateObjects,
         WorkItemPriority = workItemPriority_0
     }, workItemCallback_0, object_0);
 }
开发者ID:newchild,项目名称:Project-DayZero,代码行数:15,代码来源:WorkItemFactory.cs

示例7: ChainedDelegatesCallback

        public void ChainedDelegatesCallback()
        {
            SmartThreadPool smartThreadPool = new SmartThreadPool();
            IWorkItemsGroup workItemsGroup = smartThreadPool.CreateWorkItemsGroup(int.MaxValue);

            WorkItemCallback workItemCallback = new WorkItemCallback(DoWork);
            workItemCallback += new WorkItemCallback(DoWork);

            workItemsGroup.QueueWorkItem(workItemCallback);

            workItemsGroup.WaitForIdle();

            smartThreadPool.Shutdown();
        }
开发者ID:jogibear9988,项目名称:smartthreadpool,代码行数:14,代码来源:TestWIGChainedDelegates.cs

示例8: WorkItem

        internal WorkItem(Delegate func, object[] state)
        {
            _state = state;
            _stuck = func.Method.ReturnType != typeof(void);

            _callback = new WorkItemCallback(
                delegate {
                    if (_stuck) {
                        return func.Method.Invoke(func.Target, state);
                    }
                    else {
                        func.Method.Invoke(func.Target, state);
                        return null;
                    }
                });
        }
开发者ID:Gameman,项目名称:PlayStudio,代码行数:16,代码来源:WorkItem.cs

示例9: ChainedDelegatesCallback

        public void ChainedDelegatesCallback()
        {
            Assert.Throws<NotSupportedException>(() =>
            {

                SmartThreadPool stp = new SmartThreadPool();

                WorkItemCallback workItemCallback = new WorkItemCallback(DoWork);
                workItemCallback += new WorkItemCallback(DoWork);

                stp.QueueWorkItem(workItemCallback);

                stp.WaitForIdle();

                stp.Shutdown();
            });
        }
开发者ID:amibar,项目名称:SmartThreadPool,代码行数:17,代码来源:TestChainedDelegates.cs

示例10: ChainedDelegatesCallback

        public void ChainedDelegatesCallback()
        {
            Assert.Throws<NotSupportedException>(() =>
            {

                SmartThreadPool smartThreadPool = new SmartThreadPool();
                IWorkItemsGroup workItemsGroup = smartThreadPool.CreateWorkItemsGroup(int.MaxValue);

                WorkItemCallback workItemCallback = new WorkItemCallback(DoWork);
                workItemCallback += new WorkItemCallback(DoWork);

                workItemsGroup.QueueWorkItem(workItemCallback);

                workItemsGroup.WaitForIdle();

                smartThreadPool.Shutdown();
            });
        }
开发者ID:amibar,项目名称:SmartThreadPool,代码行数:18,代码来源:TestWIGChainedDelegates.cs

示例11: CreateWorkItem

        /// <summary>
        /// Create a new work item
        /// </summary>
        /// <param name="workItemsGroup"></param>
        /// <param name="wigStartInfo">Work item group start information</param>
        /// <param name="callback">A callback to execute</param>
        /// <param name="state">
        /// The context object of the work item. Used for passing arguments to the work item. 
        /// </param>
        /// <returns>Returns a work item</returns>
        public static WorkItem CreateWorkItem(
			IWorkItemsGroup workItemsGroup,
			WIGStartInfo wigStartInfo,
			WorkItemCallback callback, 
			object state)
        {
            ValidateCallback(callback);

            WorkItemInfo workItemInfo = new WorkItemInfo();
            workItemInfo.UseCallerCallContext = wigStartInfo.UseCallerCallContext;
            workItemInfo.UseCallerHttpContext = wigStartInfo.UseCallerHttpContext;
            workItemInfo.PostExecuteWorkItemCallback = wigStartInfo.PostExecuteWorkItemCallback;
            workItemInfo.CallToPostExecute = wigStartInfo.CallToPostExecute;
            workItemInfo.DisposeOfStateObjects = wigStartInfo.DisposeOfStateObjects;

            WorkItem workItem = new WorkItem(
                workItemsGroup,
                workItemInfo,
                callback,
                state);
            return workItem;
        }
开发者ID:arpitgold,项目名称:Exceptionless,代码行数:32,代码来源:WorkItemFactory.cs

示例12: WorkItem

	    /// <summary>
	    /// Initialize the callback holding object.
	    /// </summary>
	    /// <param name="workItemsGroup"></param>
	    /// <param name="workItemInfo"></param>
	    /// <param name="callback">Callback delegate for the callback.</param>
	    /// <param name="state">State with which to call the callback delegate.</param>
	    /// 
	    /// We assume that the WorkItem object is created within the thread
	    /// that meant to run the callback
	    public WorkItem(
			IWorkItemsGroup workItemsGroup,
			WorkItemInfo workItemInfo,
			WorkItemCallback callback, 
			object state)
		{
			_workItemsGroup = workItemsGroup;
			_workItemInfo = workItemInfo;

			if (_workItemInfo.UseCallerCallContext || _workItemInfo.UseCallerHttpContext)
			{
				_callerContext = CallerThreadContext.Capture(_workItemInfo.UseCallerCallContext, _workItemInfo.UseCallerHttpContext);
			}

			_callback = callback;
			_state = state;
			_workItemResult = new WorkItemResult(this);
			Initialize();
		}
开发者ID:BookSwapSteve,项目名称:Exceptionless,代码行数:29,代码来源:WorkItem.cs

示例13: WorkItem

        /// <summary>
        /// Initialize the callback holding object.
        /// </summary>
        /// <param name="workItemsGroup">The workItemGroup of the workitem</param>
        /// <param name="workItemInfo">The WorkItemInfo of te workitem</param>
        /// <param name="callback">Callback delegate for the callback.</param>
        /// <param name="state">State with which to call the callback delegate.</param>
        /// 
        /// We assume that the WorkItem object is created within the thread
        /// that meant to run the callback
        public WorkItem(
            IWorkItemsGroup workItemsGroup,
            WorkItemInfo workItemInfo,
            WorkItemCallback callback,
            object state)
        {
            _workItemsGroup = workItemsGroup;
            _workItemInfo = workItemInfo;

            #if !(_WINDOWS_CE) && !(_SILVERLIGHT) && !(WINDOWS_PHONE)
            if (_workItemInfo.UseCallerCallContext || _workItemInfo.UseCallerHttpContext)
            {
                _callerContext = CallerThreadContext.Capture(_workItemInfo.UseCallerCallContext, _workItemInfo.UseCallerHttpContext);
            }
            #endif

            _callback = callback;
            _state = state;
            _workItemResult = new WorkItemResult(this);
            Initialize();
        }
开发者ID:amibar,项目名称:SmartThreadPool,代码行数:31,代码来源:WorkItem.cs

示例14: CoreProcessRequest

        protected void CoreProcessRequest() {
            try {
                bool transacted = protocol.MethodAttribute.TransactionEnabled;
                if (protocol.IsOneWay) {
                    WorkItemCallback callback = null;
                    TraceMethod callbackMethod = null;
                    if (protocol.OnewayInitException != null) {
                        callback = new WorkItemCallback(this.ThrowInitException);
                        callbackMethod = Tracing.On ? new TraceMethod(this, "ThrowInitException") : null;
                    }
                    else {
                        parameters = protocol.ReadParameters();
                        callback = transacted ? new WorkItemCallback(this.OneWayInvokeTransacted) : new WorkItemCallback(this.OneWayInvoke);
                        callbackMethod = Tracing.On ? transacted ? new TraceMethod(this, "OneWayInvokeTransacted") : new TraceMethod(this, "OneWayInvoke") : null;
                    }

                    if (Tracing.On) Tracing.Information(Res.TracePostWorkItemIn, callbackMethod);
                    WorkItem.Post(callback);
                    if (Tracing.On) Tracing.Information(Res.TracePostWorkItemOut, callbackMethod);

                    protocol.WriteOneWayResponse();
                }
                else if (transacted) {
                    parameters = protocol.ReadParameters();
                    InvokeTransacted();
                }
                else {
                    parameters = protocol.ReadParameters();
                    Invoke();
                }
            }
            catch (Exception e) {
                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException) {
                    throw;
                }
                if (Tracing.On) Tracing.ExceptionCatch(TraceEventType.Error, this, "CoreProcessRequest", e);
                if (!protocol.IsOneWay)
                    WriteException(e);
            }

            TraceFlush();
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:42,代码来源:WebServiceHandler.cs

示例15: PostThreadPoolWorkItem

 internal static extern int PostThreadPoolWorkItem(WorkItemCallback callback);
开发者ID:uQr,项目名称:referencesource,代码行数:1,代码来源:UnsafeNativeMethods.cs


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