[Mono-bugs] [Bug 65734][Nor] Changed - System.Threading.Timer 20x slower than MSFT's

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Jul 31 06:33:58 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by bmaurer at users.sf.net.

http://bugzilla.ximian.com/show_bug.cgi?id=65734

--- shadow/65734	2006-07-30 20:12:31.000000000 -0400
+++ shadow/65734.tmp.23627	2006-07-31 06:33:58.000000000 -0400
@@ -40,6 +40,42 @@
 Created an attachment (id=17215)
 Single thread timer scheduler
 
 
 ------- Additional Comments From gonzalo at ximian.com  2006-07-30 20:12 -------
 If the callback throws, the scheduler thread is killed.
+
+------- Additional Comments From bmaurer at users.sf.net  2006-07-31 06:33 -------
+Style wise, this patch needs some work:
+
++			static object sync_obj = new object();
++			static object sync_obj2 = new object();
+
+How are those used?
+
+Why is TimerScheduler a class? it seems like it could be static
+methods in Timer? Also, why a TimerJob class. This is a 1<->1 relation
+with a Timer.
+
+Variables and methods are named with mixed conventions. Make things
+consistent, at the very least. In general, no underscore_names for
+methods. Also, enum values shouldn't be C_CONSTANT_NAMED.
+
++			readonly int TIME_SLICE = 10 ; // 10 msec
+
+Should be const
+
++					log("could not properly signal timer-scheduler, waiting...");
++					Thread.Sleep(5); 
+
+THis is *really* *really* dubious. You need to do something like
+"calcuate the next time you will wake up, and wait on an object with
+that timeout. Pulse the object if a new timer is added". This will
+wake up the CPU far too often, and (for example) waste battery power.
+It is a blocker for this patch.
+
++			void log(string str) {
++				if (Environment.GetEnvironmentVariable("MONO_TIMER_DEBUG") != null)
+
+Should probably be cached.
+
+


More information about the mono-bugs mailing list