Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Jul 2004 07:13:41 +1000
From:      Peter Jeremy <PeterJeremy@optushome.com.au>
To:        pradeep reddy punnam <prady_p@yahoo.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: regarding  timeout/untimeout  kernel functions
Message-ID:  <20040723211341.GK3001@cirb503493.alcatel.com.au>
In-Reply-To: <20040723005940.18029.qmail@web53410.mail.yahoo.com>
References:  <20040723005940.18029.qmail@web53410.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
[Please wrap your mail before 80 columns]

On Thu, 2004-Jul-22 17:59:40 -0700, pradeep reddy punnam wrote:
>              i am working on a project , where i came across a
>situation where i need to execute a function when a timer expires
>,exactly similar to functionality of the timeout() kernel function

How about setitimer(2) and a SIGALRM handler?

>but i need this in userland(application), and the execution of the
>function is time sensitive, it should be run immediately when timer
>expires.

What is your definition of "immediately"?  Timeouts are rounded to
ticks (and FreeBSD has a 1-2 tick slop for various reasons).  Once the
(rounded) timeout expires, then it's up to the scheduler to actually
invoke your timer handler function in line with normal scheduling
rules.  Overall, it's unlikely that your handler will get called early
but it will typically be called about 1 tick late (and there's no
upper bound on how late your handler will be invoked if the system is
heavily loaded).

-- 
Peter Jeremy



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040723211341.GK3001>