[timers] - triggering at the same time
Neeraj Rai
rneeraj at yahoo.com
Sun Dec 18 22:21:22 CET 2011
Hi,
that is correct. The timeout is associated with the resource, not the
requests, so that would be more logical.
I'll try that too.
thanks
Neeraj
==================================================
arguments are a "win win" situations. Each party goes away thinking they won.
--- On Sun, 12/18/11, Jonathan Neuschäfer <j.neuschaefer at gmx.net> wrote:
> From: Jonathan Neuschäfer <j.neuschaefer at gmx.net>
> Subject: Re: [timers] - triggering at the same time
> To: "Neeraj Rai" <rneeraj at yahoo.com>
> Cc: "Marc Lehmann" <schmorp at schmorp.de>, libev at lists.schmorp.de
> Date: Sunday, December 18, 2011, 2:06 PM
> On Sun, Dec 18, 2011 at 10:32:50AM
> -0800, Neeraj Rai wrote:
> > > otoh, why do you need the strict timer ordering?
> maybe your
> > > goal can be achieved without it?
> > We have certain resources that become available at
> certain times- the
> > times are controlled by config and subject to change.
> > When users come in looking to use the resource, and
> the resource is not
> > available, the request is queued to trigger at the
> specic time (cfg based)
> > When the time arrives, we want to give the resourse to
> users in the order
> > they requested.
>
> To me it sounds like you could have one timer that fires
> when this
> resource becomes available, and some kind of queue that
> tracks the users
> who requested it. Some pseudo-code:
>
> on request:
> if the resource is available and the request
> queue is empty:
> serve the user
> else:
> add user to the queue
>
> on resource timeout:
> while resource is available:
> get a user from the list,
> serve it
>
>
> HTH,
> Jonathan Neuschäfer
>
More information about the libev
mailing list