Am 09.08.2012 12:06, schrieb Johannes Pfau:
Am Thu, 09 Aug 2012 01:06:23 +0200
schrieb David <d...@dav1d.de>:

I was in the need for a threaded Timer, so I wrote one:

https://github.com/Dav1dde/BraLa/blob/master/brala/utils/thread.d

Do you think I should make a pull request for phobos inclusion?

A timer would be cool. It would be nicer (though more complicated to
implement) to support multiple timers running in one thread. Mono had
such an implementation in C#, but we can't use it of course (LGPL).

You would have to implement the timer completly different, it uses a Condition Lock (core.sync.cond) to wait, except you can wait on multiple locks at once and return when one of these is notified.

And we should probably try to support a generic API for timers (either
templates, isTimer!T, etc or classes+interfaces) as EventLoops (libev,
libevent, glib, windows sure has some as well) provide more efficient
ways to implement timers.

This is true, but you don't always want/need a Event Loop.

Reply via email to