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


C# IWorkItemsGroup类代码示例

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


IWorkItemsGroup类属于命名空间,在下文中一共展示了IWorkItemsGroup类的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: 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


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