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

C# WaitCallback类代码示例

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

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



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

示例1: WebcamVisionThreadGrabFrameMulti

 /// <summary>
 /// constructor
 /// </summary>
 public WebcamVisionThreadGrabFrameMulti(WaitCallback callback, object data, bool loop)
 {
     if (callback == null) throw new ArgumentNullException("callback");
     _callback = callback;
     _data = data;
     _loop = loop;
 }
开发者ID:kasertim,项目名称:sentience,代码行数:10,代码来源:WebcamVisionThreadGrabFrameMulti.cs


示例2: AsyncResult

	internal AsyncResult (WaitCallback cb, object state, bool capture_context)
	{
		async_state = state;
		async_delegate = cb;
		if (capture_context)
			current = ExecutionContext.Capture ();
	}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:7,代码来源:AsyncResult.cs


示例3: Execute

        // Main executing of commands
        internal string Execute(string clientId, string sessionId, string commands, string callback)
        {
            Log(clientId, sessionId, commands);

            string newSessionId = TTE.NewSessionId();

            try {
                string cleanCommands = _statementProcessor.Clean(commands);
                string[] splitCommands = _statementProcessor.Split(cleanCommands, false);
                ArrayList instantiatedCommands = _statementProcessor.Instantiate(splitCommands, clientId, newSessionId, callback);

                foreach (CommandContainer command in instantiatedCommands) {
                    command.OrigSessionId = sessionId;
                    _commandProcessor.Create(command);
                }

                // The callback value should be a http, https or tcp connection string, this will be called when the process has stopped running
                if (callback != "") {
                    WaitCallback wc = new WaitCallback(ProcessCommand);
                    ThreadPool.QueueUserWorkItem(wc, newSessionId);
                } else {
                    ProcessCommand(newSessionId);
                }
            } catch (Exception ex) {
                Log(ex); _messageProcessor.Create(clientId, newSessionId, Config.ClientId, enmMessageCategory.Exception, ex.Message);
            }

            return newSessionId;
        }
开发者ID:TycTak,项目名称:TycTak,代码行数:30,代码来源:CommandService.cs


示例4: ServiceJob

		/// <summary>
		/// Timer initialization
		/// </summary>
		/// <param name="workFunction">Job working function</param>
		/// <param name="workingPoints">Working time points</param>
		public ServiceJob(WaitCallback workFunction, IList<DateTime> workingPoints)
		{
			if (workingPoints == null) throw new ArgumentNullException("workingPoints");

			Execute = workFunction;
			WorkingPoints = workingPoints;
		}
开发者ID:fr4gles,项目名称:Simplify,代码行数:12,代码来源:ServiceJob.cs


示例5: Open

        public void Open()
        {
            if (listenSockets == null)
            {
                listenSockets = new List<Socket>();
                if (!ipAddress.Equals(IPAddress.Broadcast))
                {
                    listenSockets.Add(CreateListenSocket(this.ipAddress, this.port, multicast));
                }
                else
                {
                    listenSockets.Add(CreateListenSocket(IPAddress.Any, this.port, multicast));
                    if (Socket.OSSupportsIPv6)
                    {
                        listenSockets.Add(CreateListenSocket(IPAddress.IPv6Any, this.port, multicast));
                    }
                }
            }

            this.onReceive = new AsyncCallback(this.OnReceive);
            WaitCallback startReceivingCallback = new WaitCallback(StartReceiving);

            Socket[] socketsSnapshot = listenSockets.ToArray();
            for (int i = 0; i < socketsSnapshot.Length; i++)
            {
                ThreadPool.QueueUserWorkItem(startReceivingCallback, socketsSnapshot[i]);
            }
        }
开发者ID:ssickles,项目名称:archive,代码行数:28,代码来源:UdpSocketListener.cs


示例6: RequestQueue

 // ctor
 internal RequestQueue(int minExternFreeThreads, int minLocalFreeThreads, int queueLimit) {
     _minExternFreeThreads = minExternFreeThreads;
     _minLocalFreeThreads = minLocalFreeThreads;
     _queueLimit = queueLimit;
     
     _workItemCallback = new WaitCallback(this.WorkItemCallback);
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:8,代码来源:RequestQueue.cs


示例7: WorkItem

		public WorkItem(WorkItemId taskID, WaitCallback wc, IAsyncResult state, ExecutionContext ctx)
		{
			_callback = wc;
			_state = state;
			_ctx = ctx;
			_taskID = taskID;
		}
开发者ID:koder05,项目名称:fogel-ba,代码行数:7,代码来源:WorkItem.cs


示例8: AsyncProcessMessage

 public virtual IMessageCtrl AsyncProcessMessage(IMessage reqMsg, IMessageSink replySink)
 {
     ADAsyncWorkItem item = new ADAsyncWorkItem(reqMsg, this, replySink);
     WaitCallback callBack = new WaitCallback(item.FinishAsyncWork);
     ThreadPool.QueueUserWorkItem(callBack);
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:CrossAppDomainSink.cs


示例9: BeginExecute

 public override object BeginExecute(WaitCallback waitCallback, object state)
 {
     Thread result = new Thread(new ParameterizedThreadStart(waitCallback));
     result.IsBackground = true;
     result.Start(state);
     return result;
 }
开发者ID:rreynolds-yp,项目名称:csharp-swift-consoleclient,代码行数:7,代码来源:ExecutionStrategy.cs


示例10: QueueItemWrapper

 // this function adds an item to the queue, and takes care of updating the counters.
 // All functions added to the queue should be wrapped in this wrapper.
 public void QueueItemWrapper(WaitCallback workFunction, object parametersIn)
 {
     lock (counterLock)
     {
         queueLength--;
         analysisThreadCount++;
     }
     try
     {
         workFunction(parametersIn);
     }
     catch (Exception e)
     {
         // if there's an exception thrown while adding a block then we're
         // pretty much stuck. The best we can do is log it and eat it to
         // stop it killing the rest of the program.
         controller.log("Exception thrown analysing " + parametersIn.ToString());
         controller.errorLog("Exception thrown analysing " + parametersIn.ToString());
         controller.errorLog(e.ToString());
         controller.errorLog("======================");
         controller.errorLog("");
         return;
     }
     finally
     {
         lock (counterLock) analysisThreadCount--;
     }
     lock (counterLock)
     {
         totalAnalysed++;
         currentAnalysisTotal++;
     }
 }
开发者ID:ColdMatter,项目名称:EDMSuite,代码行数:35,代码来源:ThreadManager.cs


示例11: Schedule

		protected internal override void Schedule (WaitCallback callback, Guid workflowInstanceId, DateTime whenUtc, Guid timerId)
		{
			//WorkflowInstance wi = WorkflowRuntime.GetInstanceFromGuid (workflowInstanceId);

			//wi.TimerEventSubscriptionCollection.Add
			//	(new TimerEventSubscription (workflowInstanceId, timerId));
		}
开发者ID:alesliehughes,项目名称:olive,代码行数:7,代码来源:DefaultWorkflowSchedulerService.cs


示例12: Enqueue

 public static void Enqueue(WaitCallback callback, Policy policy)
 {
     switch(policy)
     {
         case Policy.Immediate:
             logger.Info("Immediately running callback {0}",
                 callback.Method.Name);
             ThreadPool.QueueUserWorkItem(new WaitCallback(callback));
             break;
         case Policy.Queued:
             lock (queue)
             {
                 if (cooledDown)
                 {
                     logger.Info("Immediately putting callback {0}",
                         callback.Method.Name);
                     ThreadPool.QueueUserWorkItem(
                         new WaitCallback(callback));
                 }
                 else
                 {
                     logger.Debug("Queuing callback {0} for later execution",
                         callback.Method.Name);
                     queue.Add(callback);
                 }
             }
             break;
     }
 }
开发者ID:hamishhill,项目名称:Beat-Machine,代码行数:29,代码来源:ExecutionQueue.cs


示例13: ThreadServerReceive

 /// <summary>
 /// constructor
 /// </summary>
 public ThreadServerReceive(WaitCallback callback, dpslamServer server, ArrayList receive_buffer)
 {
     if (callback == null) throw new ArgumentNullException("callback");
     _callback = callback;
     _server = server;
     _buffer = receive_buffer;
 }
开发者ID:kasertim,项目名称:sentience,代码行数:10,代码来源:ThreadServerReceive.cs


示例14: ConvertSqlServerToSQLiteDatabase

        /// <summary>
        /// This method takes as input the connection string to an SQL Server database
        /// and creates a corresponding SQLite database file with a schema derived from
        /// the SQL Server database.
        /// </summary>
        /// <param name="sqlServerConnString">The connection string to the SQL Server database.</param>
        /// <param name="sqlitePath">The path to the SQLite database file that needs to get created.</param>
        /// <param name="password">The password to use or NULL if no password should be used to encrypt the DB</param>
        /// <param name="handler">A handler delegate for progress notifications.</param>
        /// <param name="selectionHandler">The selection handler that allows the user to select which
        /// tables to convert</param>
        /// <remarks>The method continues asynchronously in the background and the caller returned
        /// immediatly.</remarks>
        public static void ConvertSqlServerToSQLiteDatabase(string sqlServerConnString,
            string sqlitePath, string password, SqlConversionHandler handler, 
            SqlTableSelectionHandler selectionHandler,
            FailedViewDefinitionHandler viewFailureHandler,
            bool createTriggers)
        {
            // Clear cancelled flag
            _cancelled = false;

            WaitCallback wc = new WaitCallback(delegate(object state)
            {
                try
                {
                    _isActive = true;
                    ConvertSqlServerDatabaseToSQLiteFile(sqlServerConnString, sqlitePath, password, handler, selectionHandler, viewFailureHandler, createTriggers);
                    _isActive = false;
                    handler(true, true, 100, "Finished converting database");
                }
                catch (Exception ex)
                {
                    _log.Error("Failed to convert SQL Server database to SQLite database", ex);
                    _isActive = false;
                    handler(true, false, 100, ex.Message);
                } // catch
            });
            ThreadPool.QueueUserWorkItem(wc);
        }
开发者ID:sridhar19091986,项目名称:htmlconvertsql,代码行数:40,代码来源:SqlServerToSQLite.cs


示例15: OnBegin

 //异步页面的任务启动方法
 public IAsyncResult OnBegin(object sender, EventArgs e,
     AsyncCallback cb, object extraData)
 {
     _proc = new WaitCallback(ChatInvokeProc);
     Hashtable theUser = new Hashtable();
     theUser = (Hashtable)extraData;
     string user = theUser["guid"].ToString();
     _guid = user;
     Thread.CurrentThread.Name = "上下文线程" + user;
     //用户处理,不存在则增加,即为登录
     theUser["asyn"] = this;
     theUser["lastUpdateTime"] = DateTime.Now.ToString();
     Hashtable feachUser = new Hashtable();
     bool isInCach=false;
     for (var i = 0; i < globalCache.userCache.Count; i++)
     {
         feachUser = (Hashtable)globalCache.userCache[i];
         if (theUser["guid"].ToString() == feachUser["guid"].ToString())
         {
             globalCache.userCache[i] = theUser;
             isInCach = true;
         }
     }
     if (!isInCach)
     {
         globalCache.userCache.Add(theUser);
     }
     //开始异步执行,这里会开启一个新的辅助线程
     return _proc.BeginInvoke(extraData, cb, extraData);
 }
开发者ID:inlost,项目名称:moyo,代码行数:31,代码来源:Chat_Message.cs


示例16: QuotaThrottle

 internal QuotaThrottle(WaitCallback release, object mutex)
 {
     this.limit = Int32.MaxValue;
     this.mutex = mutex;
     this.release = release;
     this.waiters = new Queue<object>();
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:QuotaThrottle.cs


示例17: CallbackInfo

 public CallbackInfo(WaitCallback callback, Guid instanceId, Guid timerId, DateTime when)
 {
     this.callback = callback;
     this.when = when;
     this.instanceId = instanceId;
     this.timerId = timerId;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:ManualWorkflowSchedulerService.cs


示例18: Queue

 /// <summary>
 /// Enqueues action.
 /// </summary>
 /// <param name="callback"></param>
 public void Queue(WaitCallback callback)
 {
     if (!ThreadPool.QueueUserWorkItem(callback))
     {
         throw new QueueFullException("Unable to add item to pool: " + callback.Target);
     }
 }
开发者ID:huangyingwen,项目名称:retlang,代码行数:11,代码来源:DefaultThreadPool.cs


示例19: Schedule

		protected override void Schedule (WaitCallback callback, Guid workflowInstanceId)
		{
			Console.WriteLine ("*** ourDefaultWorkflowSchedulerService::Schedule {0} {1}",
				callback, workflowInstanceId);

			base.Schedule (callback, workflowInstanceId);
		}
开发者ID:alesliehughes,项目名称:olive,代码行数:7,代码来源:SchedulerMonitor.cs


示例20: AsyncDialogForm

        /// <summary>
        /// Initializes a new instance of the <see cref="AxAsyncProgress"/> class.
        /// </summary>
        public AsyncDialogForm(string formCaption, IExecutorService executorService,
            int minimum, int maximum,
            AsyncWaitCallback callback,
            AsyncWaitCallback finishedCallback,
            AsyncWaitCallback abortCallback)
        {
            InitializeComponent();
            SetTagProperty();
            this.ResolveResources();
            _elapsedTimer = AsyncProgressTimerFactory.Create();
            _executorService = executorService;
            _actualCallback = new WaitCallback(this.ExecAsync);
            _updateStatus = new UpdateAsyncStatusHandler(this.UpdateStatus);
            _updateStatusProgress = new UpdateAsyncStatusProgressHandler(this.UpdateStatusProgress);
            _enableButton = new EnableButtonHandler(this.EnableOKButton);
            this.InitializeProgress(minimum, maximum);

            btnCancel.Enabled = (_executorService != null);
            if (_executorService != null)
            {
                IExecutorService2 executor2 = _executorService as IExecutorService2;
                if (executor2 != null)
                {
                    executor2.Reset();
                }
            }

            this.Text = formCaption;
            lblStatus.Text = formCaption;
            this.Initialize(callback, finishedCallback, abortCallback, this);
        }
开发者ID:sreenandini,项目名称:test_buildscripts,代码行数:34,代码来源:AsyncDialogForm.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# WaitDialogForm类代码示例发布时间:2022-05-24
下一篇:
C# WWWForm类代码示例发布时间: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