Timer and Event class

Johannes Pfau nospam at example.com
Thu Aug 9 03:06:20 PDT 2012


Am Thu, 09 Aug 2012 01:06:23 +0200
schrieb David <d at 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).

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.

As for the event struct: I'm not sure, as a implementation detail it's
fine, but as a public API I'm not sure.


More information about the Digitalmars-d mailing list