On 7/20/11 12:05 PM, Martin Nowak wrote:
It would be really better if phobos had some kind of timer. The thread
solution is really suboptimal.

I think a major problem when trying to implement a general-purpose solution is that, by its very nature, a timer depends on the event handling scheme used.

For example, if you wanted to use a timer on Posix to interrupt your potentially blocking system calls, you would use alarm() to set a signal-based timeout and register a signal handler for it. On the other hand, a typical GUI application has its own event loop to integrate with, for an application using non-blocking I/O, you would like to transparently map your timers on select()/… timeout arguments, etc.

David

Reply via email to