...中删除 private synchronized void fillPool() //维护连接池大小 public synchronized void TimerEvent() //定时器事件处理函数 ..
基于38个网页-相关网页
就像一个典型窗体程序里的其它代码一样,任何驻留在一个定时器事件处理函数(指的是该类型的定时器类)中的代码也是使用应用程序的UI线程所执行。
Just like the rest of the code in a typical Windows Forms application, any code that resides inside a timer event handler (for this type of timer class) is executed using the application's UI thread.
因为UI线程在睡眠,所以当UI线程一旦被唤醒例子程序就会列出5个定时器事件(4到8)并能够处理处理函数。
Because the UI thread was sleeping, however, the sample application displays the five timer events (4 through 8) all at once when the UI thread wakes up again and is able to process the handlers.
为了最大限度的代码重用,三种不同类型的定时器事件都调用了同样的ShowTimerEventFired方法,下面就是三个定时器事件的处理函数。
To maximize code reuse, the sample application calls the same ShowTimerEventFired method from all three different types of timer events. Here are the three timer event handlers.
应用推荐