• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IWorkItemsGroup类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

 /// <summary>
 /// 实例化QueueService
 /// </summary>
 /// <param name="smart"></param>
 /// <param name="logger"></param>
 /// <param name="service"></param>
 /// <param name="elapsedTime"></param>
 public AsyncService(IWorkItemsGroup group, ILog logger, IService service, TimeSpan elapsedTime)
 {
     this.smart = group;
     this.logger = logger;
     this.service = service;
     this.elapsedTime = elapsedTime;
 }
开发者ID:rajayaseelan,项目名称:mysoftsolution,代码行数:14,代码来源:AsyncService.cs


示例3: HttpServiceCaller

 /// <summary>
 /// HttpServiceCaller初始化
 /// </summary>
 /// <param name="group"></param>
 /// <param name="config"></param>
 /// <param name="container"></param>
 public HttpServiceCaller(IWorkItemsGroup group, CastleServiceConfiguration config, IServiceContainer container)
 {
     this.config = config;
     this.container = container;
     this.smart = group;
     this.callers = new HttpCallerInfoCollection();
     this.callTimeouts = new Dictionary<string, int>();
 }
开发者ID:rajayaseelan,项目名称:mysoftsolution,代码行数:14,代码来源:HttpServiceCaller.cs


示例4: QuickSort

        /// <summary>
        /// QuickSort array using wig to parallel the sort
        /// </summary>
        /// <param name="wig">A IWorkItemsGroup to use to parallel the sort</param>
        /// <param name="array">The array of items to sort</param>
        public static void QuickSort(IWorkItemsGroup wig, int[] array)
        {
            // Initiate the QuickSort
            wig.QueueWorkItem(QuickSort, wig, array, 0, array.Length - 1);

            // Wait for the sort to complete.
            wig.WaitForIdle();
        }
开发者ID:laoqiuChina,项目名称:SmartThreadPool,代码行数:13,代码来源:ParallelQuickSort.cs


示例5: WigEntry

 public WigEntry(
     IWorkItemsGroup wig,
     QueueUsageControl queueUsageControl,
     Label isIdle)
 {
     _wig = wig;
     _queueUsageControl = queueUsageControl;
     _isIdle = isIdle;
 }
开发者ID:laoqiuChina,项目名称:SmartThreadPool,代码行数:9,代码来源:Form1.cs


示例6: WorkGroupWithItem

        /// <summary>
        /// Initializes a new instance of the <see cref="WorkGroupWithItem"/> class.
        /// </summary>
        /// <param name="sourceGroup">The source group.</param>
        /// <param name="threadGroup">The thread group.</param>
        /// <param name="metricCounter">A counter for tracking how many items are being processed</param>
        public WorkGroupWithItem(IWorkGroup sourceGroup, IWorkItemsGroup threadGroup, ICounter metricCounter)
        {
            Guard.NotNull(() => sourceGroup, sourceGroup);
            Guard.NotNull(() => threadGroup, threadGroup);
            Guard.NotNull(() => metricCounter, metricCounter);

            GroupInfo = sourceGroup;
            Group = threadGroup;
            MaxWorkItems = GroupInfo.ConcurrencyLevel + GroupInfo.MaxQueueSize;
            MetricCounter = metricCounter;
        }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:17,代码来源:WorkGroupWithItem.cs


示例7: TestQueueWorkItemCall

        //IWorkItemResult QueueWorkItem(WorkItemCallback callback);
        public static void TestQueueWorkItemCall(IWorkItemsGroup wig)
        {
            WorkItemInfo wii = new WorkItemInfo();
            WorkItemInfoComparer wiic = new WorkItemInfoComparer(wii);

            IWorkItemResult wir = wig.QueueWorkItem(wiic.CompareWorkItemInfo);

            bool success = (bool)wir.Result;

            Assert.IsTrue(success);
        }
开发者ID:jogibear9988,项目名称:smartthreadpool,代码行数:12,代码来源:QueueWorkItemHelper.cs


示例8: TestQueueWorkItemCallStat

        //IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state);
        public static void TestQueueWorkItemCallStat(IWorkItemsGroup wig)
        {
            object state = new object();
            WorkItemInfo wii = new WorkItemInfo();
            WorkItemInfoComparer wiic = new WorkItemInfoComparer(wii, state);

            IWorkItemResult wir = wig.QueueWorkItem((WorkItemCallback) wiic.CompareWorkItemInfo, state);

            bool success = (bool)wir.Result;

            Assert.IsTrue(success);
        }
开发者ID:jogibear9988,项目名称:smartthreadpool,代码行数:13,代码来源:QueueWorkItemHelper.cs


示例9: TestQueueWorkItemCallPrio

        //IWorkItemResult QueueWorkItem(WorkItemCallback callback, WorkItemPriority workItemPriority);
        public static void TestQueueWorkItemCallPrio(IWorkItemsGroup wig)
        {
            WorkItemInfo wii = new WorkItemInfo();
            wii.WorkItemPriority = WorkItemPriority.AboveNormal;
            WorkItemInfoComparer wiic = new WorkItemInfoComparer(wii);

            IWorkItemResult wir = wig.QueueWorkItem((WorkItemCallback)wiic.CompareWorkItemInfo, WorkItemPriority.AboveNormal);

            bool success = (bool)wir.Result;

            Assert.IsTrue(success);
        }
开发者ID:jogibear9988,项目名称:smartthreadpool,代码行数:13,代码来源:QueueWorkItemHelper.cs


示例10: TestQueueWorkItemCallStatPrio

        //IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, WorkItemPriority workItemPriority);
        public static void TestQueueWorkItemCallStatPrio(IWorkItemsGroup wig)
        {
            object state = new object();
            WorkItemInfo wii = new WorkItemInfo();
            wii.WorkItemPriority = WorkItemPriority.AboveNormal;
            WorkItemInfoComparer wiic = new WorkItemInfoComparer(wii, state);

            IWorkItemResult wir = wig.QueueWorkItem(wiic.CompareWorkItemInfo, state, WorkItemPriority.AboveNormal);

            bool success = (bool)wir.Result;

            Assert.IsTrue(success);
        }
开发者ID:kesyw,项目名称:SmartThreadPool,代码行数:14,代码来源:QueueWorkItemHelper.cs


示例11: 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


示例12: ServiceCaller

        /// <summary>
        /// 初始化ServiceCaller
        /// </summary>
        /// <param name="group"></param>
        /// <param name="status"></param>
        public ServiceCaller(IWorkItemsGroup group, ServerStatusService status)
        {
            this.status = status;
            this.smart = group;
            this.callbackTypes = new Dictionary<string, Type>();
            this.callTimeouts = new Dictionary<string, int>();

            //初始化服务
            InitServiceCaller(status.Container);

            //注册状态服务
            var hashtable = new Dictionary<Type, object>();
            hashtable[typeof(IStatusService)] = status;

            //注册组件
            status.Container.RegisterComponents(hashtable);
        }
开发者ID:rajayaseelan,项目名称:mysoftsolution,代码行数:22,代码来源:ServiceCaller.cs


示例13: Concurrency

		private void Concurrency(
			int concurrencyPerWig,
			int wigsCount,
			int workItemsCount)
		{
			Console.WriteLine(
				"Testing : concurrencyPerWig = {0}, wigsCount = {1}, workItemsCount = {2}",
				concurrencyPerWig,
				wigsCount,
				workItemsCount);

			_success = true;
			_concurrencyPerWig = concurrencyPerWig;
			_randGen = new Random(0);

			STPStartInfo stpStartInfo = new STPStartInfo();
			stpStartInfo.StartSuspended = true;

			SmartThreadPool stp = new SmartThreadPool(stpStartInfo);

			_concurrentOps = new int[wigsCount];

			IWorkItemsGroup [] wigs = new IWorkItemsGroup[wigsCount];

			for(int i = 0; i < wigs.Length; ++i)
			{
				wigs[i] = stp.CreateWorkItemsGroup(_concurrencyPerWig);
				for(int j = 0; j < workItemsCount; ++j)
				{
					wigs[i].QueueWorkItem(new WorkItemCallback(this.DoWork), i);
				}

				wigs[i].Start();
			}

			stp.Start();

			stp.WaitForIdle();

			Assert.IsTrue(_success);

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


示例14: TestQueueWorkItemCallStatPost

        //IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, PostExecuteWorkItemCallback postExecuteWorkItemCallback);
        public static void TestQueueWorkItemCallStatPost(IWorkItemsGroup wig)
        {
            bool postExecuteCalled = false;
            object state = new object();
            PostExecuteWorkItemCallback postExecuteWorkItemCallback = delegate(IWorkItemResult w) { postExecuteCalled = true; };
            WorkItemInfo wii = new WorkItemInfo();
            wii.PostExecuteWorkItemCallback = postExecuteWorkItemCallback;
            WorkItemInfoComparer wiic = new WorkItemInfoComparer(wii, state);

            IWorkItemResult wir = wig.QueueWorkItem(
                wiic.CompareWorkItemInfo,
                state,
                postExecuteWorkItemCallback);

            // We must wait for idle to let the post execute run
            wig.WaitForIdle();

            bool success = (bool)wir.Result;

            Assert.IsTrue(success);
            Assert.IsTrue(postExecuteCalled);
        }
开发者ID:jogibear9988,项目名称:smartthreadpool,代码行数:23,代码来源:QueueWorkItemHelper.cs


示例15: 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


示例16: WasQueuedBy

		internal bool WasQueuedBy(IWorkItemsGroup workItemsGroup)
		{
			return (workItemsGroup == _workItemsGroup);
		}
开发者ID:BookSwapSteve,项目名称:Exceptionless,代码行数:4,代码来源:WorkItem.cs


示例17: 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


示例18: UnregisterWorkItemsGroup

 // Token: 0x060017EF RID: 6127
 // RVA: 0x00014AE4 File Offset: 0x00012CE4
 internal void UnregisterWorkItemsGroup(IWorkItemsGroup iworkItemsGroup_0)
 {
     if (this._workItemsGroups.Contains(iworkItemsGroup_0))
     {
         this._workItemsGroups.Remove(iworkItemsGroup_0);
     }
 }
开发者ID:newchild,项目名称:Project-DayZero,代码行数:9,代码来源:SmartThreadPool.cs


示例19: RegisterWorkItemsGroup

 // Token: 0x060017EE RID: 6126
 // RVA: 0x00014AD5 File Offset: 0x00012CD5
 internal void RegisterWorkItemsGroup(IWorkItemsGroup iworkItemsGroup_0)
 {
     this._workItemsGroups[iworkItemsGroup_0] = iworkItemsGroup_0;
 }
开发者ID:newchild,项目名称:Project-DayZero,代码行数:6,代码来源:SmartThreadPool.cs


示例20: ValidateWorkItemsGroupWaitForIdleImpl

 private void ValidateWorkItemsGroupWaitForIdleImpl(IWorkItemsGroup workItemsGroup, WorkItem workItem)
 {
     if ((null != workItemsGroup) && 
         (null != workItem) &&
         workItem.WasQueuedBy(workItemsGroup))
     {
         throw new NotSupportedException("WaitForIdle cannot be called from a thread on its SmartThreadPool, it will cause may cause a deadlock");
     }
 }
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:9,代码来源:SmartThreadPool.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IWorkbook类代码示例发布时间:2022-05-24
下一篇:
C# IWorkItemResult类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap