timer

Heavy Load C# Application Freezes when Mouse Event is Activated

Hello. My C# application has a timer that triggers an event every 100 milliseconds. Inside this event there is a receive handler for bus traffic that loops continuously until the receive buffer is empty, or another 100 milliseconds has elapsed. This works fine until I try to use one of the other controls in my application at run time....

How to run something every t seconds in C?

In C, I want a block of statements to be executed repeatedly every t seconds. How do I do this? ...

C# Application Becomes Slow and Unresponsive as String in Multiline Textbox Grows

Hello. I have a C# application in which a LOT of information is being added to a Textbox for display to the user. Upon processing of the data, almost immediately, the application becomes very slow and unresponsive. This is how I am currently attempting to handle this: var saLines = textBox1.Lines; var saNewLines = saLines.Skip(...

ObjectDisposedException - running stopwatch in GUI thread

I have a stopwatch running in a different thread, that updates the GUI thread in a label to show as time goes by. When my program closes, it throws a ObjectDisposedException when I call this.Invoke(mydelegate); in the Form GUI to update the label with the time from the stopwatch. How do I get rid of this ObjectDisposedException? I...

need programs that illustrate use of settimer and alarm functions in GNU C

Can anyone illustrate the use of settimer or alarm function in gnu C , with some program examples ,please ? I have a program that continuously processes some data , and i need to set a timer / alarm that goes off every t seconds , in response to which , i need to store the processed data into a file. This file writing has to be asynchro...

Set the name of a thread created with SetTimer() API

I create a Windows timer using the following FHandle := SetTimer(0, 0, 1000, TFNTimerProc(@TMyClass.MyMethod)); Is this thread shown in the Delphi "Threads" window. If Yes how I can get this Thread ID? ...

need help regarding a packet capture program

Hi all , The following is a program that captures TCP packets < port 80 > and prints header related information in the console for every packet. I have also included a timer , so that after every 1000 millisec i.e. 1 sec , the frequency of occurence of various flags , and distinct number of Src IPs , Ack nos and Seq nos encountered are...

Pausing/stopping and starting/resuming Java TimerTask continuously?

Hi all I have one simple question regarding Java TimerTask. How do I pause/resume two TimerTask tasks based on a certain condition? For example I have two timers that run between each other. When a certain condition has been met inside the task of first timer, the first timer stops and starts the second timer, and the same thing happens...

To avoid scren flickering on timer java

I'm working on a java game. in which after some regular millisecond i'm repainting the screen. But if the timer duration becomes very less then in that case screen starts flickering. Is there any way to avoid it?? Can we use Multithreading to avoid this??? ...

How to stop DispatcherTimer from inside Try - Catch?

Please, help me to understand how I could stop attempts of executing MethodOne() inside a dispatcherTimer.Tick event handler of WPF DispatcherTimer after first unsuccessful attempt of doing it. TimeSpan ts = new TimeSpan(0, 0, 5); DispatcherTimer dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += ne...

How to stop endless EJB 3 timer ?

Hi, I am new to EJB 3 . I use the following code to start endless EJB 3 timer then deploying it on JBOSS 4.2.3 @Stateless public class SimpleBean implements SimpleBeanRemote,TimerService { @Resource TimerService timerService; private Timer timer ; @Timeout public void timeout(Timer timer) { System.out.println("Hello EJB"); } }...

Using Android's `Timer.schedule` in Python

Could someone explain how to use the Timer.schedule - that is used for scheduling tasks - in Python? Note that Python's time.sleep will not work in Android. ...

as3, function active after 3 seconds

Hi, I have 2 functions going in as3: function blueDownBounce (e:MouseEvent):void { var blueDownY:Tween = new Tween(blue, "y", Regular.easeOut, -49, -19, 1, true); } blue.addEventListener(MouseEvent.MOUSE_OVER, blueDownBounce); function blueUpBounce (e:MouseEvent):void { var blueUpY:Tween = new Tween(blue, "y", Bounce.easeOut, ...

scheduling runnable tasks in java

I am following up an interesting question on so, on usage of ScheduledThreadPoolExecutor for some repeating task. Scheduling this object returns a ScheduledFuture object which one can use to cancel the next run of the task. One thing to note here is the task itself is completely decoupled from the schedule-- ScheduledExecutorService...

How to play sound in Python WITHOUT interrupting music/other sounds from playing

I'm working on a timer in python which sounds a chime when the waiting time is over. I use the following code: from wave import open as wave_open from ossaudiodev import open as oss_open def _play_chime(): """ Play a sound file once. """ sound_file = wave_open('chime.wav','rb') (nc,sw,fr,nf,comptype, compname) = so...

How to create timer in WinApi (C++)?

How to create timer in WinApi (C++)? ...

How to hook into the Apple clock timer API in iPhone SDK 3.0?

I have heard that there are some apps that hook into the Apple processes that will run in the background (namely, hooking into the Apple clock timer API), which will allow some non-UI background process on your 3rd party app to continue to run. Is this legitimate? Supposedly, there are some GPS-tracker apps that are using this and have p...

Classes, methods, and polymorphism in Python

I made a module prototype with the aim of building complex timer schedules in python. The class prototypes emulate Timer objects, each with their waiting times, Repeat objects that group Timer and other Repeat objects, and a Schedule class, just for holding a whole construction or Timers and Repeat instances. The construction can be as c...

Memory leak while sending email

Hello everybody! I have a windows service, which is configured to send emails in a predefined schedule. The schedule works with System.Timers.Timer and every time the Timer_Elapsed is raised I call Timer.Stop(), send emails (each time about 1500 emails), calculate the amount of time the next tick will be raised and start the timer (call...

resettable timeout in Java

(similar to "Resettable Java Timer" but there are some subtleties I need to explore) I need a resettable timeout feature, so that if my class does not perform a particular action within an interval of time T0 (where T0 is in the neighborhood of 50-1000msec), then a method gets called: class MyClass { static final private timeoutTim...