August 01, 2012 Timers: setInterval and setTimeout | ||||
|---|---|---|---|---|
| ||||
Hello all, I'm looking for the right way to implement Javascript-like setInterval and setTimeout in D. I don't want to use multiple threads + sleep as an implementation. It needs to be single threaded. I was thinking along the lines of creating a timer using ualarm/settimer and listening to SIGALARM. I want it to be efficient as i'll be using it for timing out HTTP requests. Can someone guide me in the right direction? Thanks for any help, Shripad K. | ||||
August 01, 2012 Re: Timers: setInterval and setTimeout | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Shripad K | Okay really sorry to bother you all. I found a better way of dealing with timers. Coupled tango's signal/slot implementation with its Selector abstraction (with timeout) and things work like a charm.
On Wednesday, 1 August 2012 at 18:15:44 UTC, Shripad K wrote:
> Hello all,
>
> I'm looking for the right way to implement Javascript-like setInterval and setTimeout in D.
>
> I don't want to use multiple threads + sleep as an implementation. It needs to be single threaded. I was thinking along the lines of creating a timer using ualarm/settimer and listening to SIGALARM. I want it to be efficient as i'll be using it for timing out HTTP requests.
>
> Can someone guide me in the right direction?
>
> Thanks for any help,
> Shripad K.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply