timer

Code should be executed one time after short delay

流过昼夜 提交于 2019-12-22 07:40:10
问题 I have this Timer : Timer delayTimer = new Timer(); delayTimer.Interval = 500; delayTimer.Elapsed += (object sender, ElapsedEventArgs e) => { Console.WriteLine("test"); textInputDialog.Show(); delayTimer.Stop(); }; delayTimer.Start(); Here I have the following problems: Timer never stops. Code is executed every 500ms. textInputDialog.Show(); doesn't work (perhaps cause of problem above) What is wrong with my code? Alternative solutions: This is an alternative to timer as Jens Horstmann

Periodic tasks inside WCF service hosted in IIS

梦想的初衷 提交于 2019-12-22 06:59:37
问题 We would like to have some periodic actions executed by our WCF service hosted in IIS. What is the best way to do this? Creating a timer doesn't look as a good solution. Creating a windows service that would behave as some kind of a heart beat looks like a problem solution, but it still doesn't smell good. What approach will be a good solution to this problem? 回答1: That depends on what your action is trying to do. If it's a database related clean up action, e.g. deleting orphaned shopping

high precision timer in Swift

半腔热情 提交于 2019-12-22 06:46:55
问题 What would be the best solution in Swift for a precise clock to control external hardware? I need to write a loop function that would fire at a set rate per second (hundreds or thousands Hz) reliably and with high precision. 回答1: You can define a GCD timer property (because unlike NSTimer / Timer , you have to maintain your own strong reference to the GCD timer): var timer: DispatchSourceTimer! And then make a timer (probably a .strict one that is not subject to coalescing, app nap, etc.,

Non blocking event scheduling in python

允我心安 提交于 2019-12-22 06:22:52
问题 Is it possible to schedule a function to execute at every xx millisecs in python,without blocking other events/without using delays/without using sleep ? What is the best way to repeatedly execute a function every x seconds in Python? explains how to do it with sched module, but the solution will block the entire code execution for the wait time(like sleep). The simple scheduling like the one given below is non blocking, but the scheduling works only once- rescheduling is not possible. from

How to implement a timeout control for urlllib2.urlopen

元气小坏坏 提交于 2019-12-22 06:15:50
问题 How to implement a controlling for urlllib2.urlopen in Python ? I just wanna monitor that if in 5 seconds no xml data return, cut this connection and connect again? Should I use some timer? thx 回答1: urllib2.urlopen("http://www.example.com", timeout=5) 回答2: From the urllib2 documentation... The optional timeout parameter specifies a timeout in seconds for blocking operations like the connection attempt (if not specified, the global default timeout setting will be used). This actually only

When my timer ticks… .NET Memory Leak

混江龙づ霸主 提交于 2019-12-22 04:56:14
问题 I have a .NET System.Threading.Timer timer that ticks every 60 seconds and introduces a memory leak on each tick. On each tick of the timer, the code allocates an IDisposable object (called SocketsMessageConnector)...but I do dispose it correctly. I ran .NET Memory Profiler and every 60 seconds I see a new instance of my SocketsMessageConnector class lingering in memory (so after 15 minutes, I have 15 instances). The memory profiler verifies that the instance is in fact disposed, but it shows

How can i create a multithread in C for windows?

孤人 提交于 2019-12-22 04:55:38
问题 I dont know how can I make threads in C, i saw a review about pthread.h library but then i heard that its only for Linux OS, i have a function that its a timer, i want to created a thread with that function but i dont know either the library i need to use and syntax's to write the code, if someone could provide me a simple code with threads, or tell me what things i need to put and the parameter of the functions. Here its the function i create that countdown the specific time the user apply:

Timer in Silverlight

青春壹個敷衍的年華 提交于 2019-12-22 04:45:29
问题 Is there another Timer object that can be used in Silverlight except for the System.Threading.Timer object? 回答1: Check out the DispatcherTimer: http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatchertimer(VS.95).aspx 回答2: storyboard is a timer too 来源: https://stackoverflow.com/questions/839875/timer-in-silverlight

Timer more reliable than System.Threading.Timer

蓝咒 提交于 2019-12-22 04:43:34
问题 I'm currently using the System.Threading.Timer on a 10 second interval. I've adding a small piece of code to write to a file each time the timer fires, and whilst most of the time it fires on-time, sometimes (presumably when the rest of the app is buy), fails to fire for 30 or 40 seconds, and fires over and over again in quick succession. Is there a more reliable timer I can use in .NET 3.5? The timer is setup as follows Timer someTimer = new Timer(new TimerCallback(SomeMethod), null, 0,

Change linux kernel timer

时光怂恿深爱的人放手 提交于 2019-12-22 04:09:10
问题 I have to run a latency sensitive application and I have been asked to change the timer resolution to 1000 Hz or more. I searched on the net a bit and found pages about CONFIG_HZ etc. However, there are what seem to be several other related settings in the file as well, so I want to be sure that I don't mess the settings up. I am posting some output here $cat /boot/config-2.6.28-11-generic | grep HZ # CONFIG_HZ_1000 is not set # CONFIG_HZ_300 is not set CONFIG_MACHZ_WDT=m CONFIG_NO_HZ=y