Query : Timer and timeout facility in terms of number of ticks in linux - Linux
This is a discussion on Query : Timer and timeout facility in terms of number of ticks in linux - Linux ; Hi,
I am using kernel-2.4.22 (FC1). I am interested in developing
applications using timers and timeout.
My requirement is:
1) start a timer with :
a) some Identifier or handle or the start timer function
should return a timer id ...
-
Query : Timer and timeout facility in terms of number of ticks in linux
Hi,
I am using kernel-2.4.22 (FC1). I am interested in developing
applications using timers and timeout.
My requirement is:
1) start a timer with :
a) some Identifier or handle or the start timer function
should return a timer id or
handle.
b) specifying a timeount in number of ticks (each tick = 10
ms)
c) specifying the function to be called after the timeout
2) deleting or killing the timer with specified ID or handle so that no
other process or thread can use it further.
It should be siomething like this:
start_timer(timer-handle,time-out in ticks, time-out function)
OR
ID(Timer-handle) = start_timer(time-out in ticks, time-out function)
stop_timer(timer-handle)
Is there a way to implement such a design in linux?
or what could be the approach which fits my requirements most closely?
Thanks
Jasdeep
-
Re: Query : Timer and timeout facility in terms of number of ticks in linux
On Jan 17, 3:28 pm, "jas" wrote:
> Hi,
> I am using kernel-2.4.22 (FC1). I am interested in developing
> applications using timers and timeout.
> My requirement is:
>
> 1) start a timer with :
> a) some Identifier or handle or the start timer function
> should return a timer id or
> handle.
> b) specifying a timeount in number of ticks (each tick = 10
> ms)
> c) specifying the function to be called after the timeout
>
> 2) deleting or killing the timer with specified ID or handle so that no
> other process or thread can use it further.
>
> It should be siomething like this:
>
> start_timer(timer-handle,time-out in ticks, time-out function)
> OR
> ID(Timer-handle) = start_timer(time-out in ticks, time-out function)
>
> stop_timer(timer-handle)
>
> Is there a way to implement such a design in linux?
> or what could be the approach which fits my requirements most closely?
Use Posix function:
timer_create
timer_settime
etc.
>
> Thanks
> Jasdeep
-
Re: Query : Timer and timeout facility in terms of number of ticks in linux
hello Bin,
Bin Chen wrote:
> On Jan 17, 3:28 pm, "jas" wrote:
> > Hi,
> > I am using kernel-2.4.22 (FC1). I am interested in developing
> > applications using timers and timeout.
> > My requirement is:
> >
> > 1) start a timer with :
> > a) some Identifier or handle or the start timer function
> > should return a timer id or
> > handle.
> > b) specifying a timeount in number of ticks (each tick = 10
> > ms)
> > c) specifying the function to be called after the timeout
> >
> > 2) deleting or killing the timer with specified ID or handle so that no
> > other process or thread can use it further.
> >
> > It should be siomething like this:
> >
> > start_timer(timer-handle,time-out in ticks, time-out function)
> > OR
> > ID(Timer-handle) = start_timer(time-out in ticks, time-out function)
> >
> > stop_timer(timer-handle)
> >
> > Is there a way to implement such a design in linux?
> > or what could be the approach which fits my requirements most closely?
> Use Posix function:
> timer_create
> timer_settime
> etc.
i was looking into butenhof's programming with posix threads book for
timer_create
and timer_settime. I tried to compile the code given in the book but
its showing undefined refernce to timer_create and timer_settime.
the header files used in the code are :
#include
#include
#include
in my Makefile i am providing the link path for pthread library as
follows:
-L/usr/lib -pthread which is correct i suppose. 
where are these functions timer_create() and timer_settime() defined?
> >
> > Thanks
> > Jasdeep
-
Re: Query : Timer and timeout facility in terms of number of ticks in linux
i have got to get the things work...........i added -lrt in the link
path.
Thanks Bin
jas wrote:
> hello Bin,
> Bin Chen wrote:
> > On Jan 17, 3:28 pm, "jas" wrote:
> > > Hi,
> > > I am using kernel-2.4.22 (FC1). I am interested in developing
> > > applications using timers and timeout.
> > > My requirement is:
> > >
> > > 1) start a timer with :
> > > a) some Identifier or handle or the start timer function
> > > should return a timer id or
> > > handle.
> > > b) specifying a timeount in number of ticks (each tick = 10
> > > ms)
> > > c) specifying the function to be called after the timeout
> > >
> > > 2) deleting or killing the timer with specified ID or handle so that no
> > > other process or thread can use it further.
> > >
> > > It should be siomething like this:
> > >
> > > start_timer(timer-handle,time-out in ticks, time-out function)
> > > OR
> > > ID(Timer-handle) = start_timer(time-out in ticks, time-out function)
> > >
> > > stop_timer(timer-handle)
> > >
> > > Is there a way to implement such a design in linux?
> > > or what could be the approach which fits my requirements most closely?
> > Use Posix function:
> > timer_create
> > timer_settime
> > etc.
>
> i was looking into butenhof's programming with posix threads book for
> timer_create
> and timer_settime. I tried to compile the code given in the book but
> its showing undefined refernce to timer_create and timer_settime.
>
> the header files used in the code are :
>
> #include
> #include
> #include
>
> in my Makefile i am providing the link path for pthread library as
> follows:
> -L/usr/lib -pthread which is correct i suppose. 
>
> where are these functions timer_create() and timer_settime() defined?
> > >
> > > Thanks
> > > Jasdeep
-
Re: Query : Timer and timeout facility in terms of number of ticks in linux
Hi,
I am enjoying my work with timers and its quite interesting, though at
times giving me tough time. 
How to pass a parameter (integer type) to the thread function which is
called at timeout of the timer.
any sample code will be extremely helpful for me.
thanks
--jasdeep
jas wrote:
> i have got to get the things work...........i added -lrt in the link
> path.
> Thanks Bin
> jas wrote:
> > hello Bin,
> > Bin Chen wrote:
> > > On Jan 17, 3:28 pm, "jas" wrote:
> > > > Hi,
> > > > I am using kernel-2.4.22 (FC1). I am interested in developing
> > > > applications using timers and timeout.
> > > > My requirement is:
> > > >
> > > > 1) start a timer with :
> > > > a) some Identifier or handle or the start timer function
> > > > should return a timer id or
> > > > handle.
> > > > b) specifying a timeount in number of ticks (each tick = 10
> > > > ms)
> > > > c) specifying the function to be called after the timeout
> > > >
> > > > 2) deleting or killing the timer with specified ID or handle so that no
> > > > other process or thread can use it further.
> > > >
> > > > It should be siomething like this:
> > > >
> > > > start_timer(timer-handle,time-out in ticks, time-out function)
> > > > OR
> > > > ID(Timer-handle) = start_timer(time-out in ticks, time-out function)
> > > >
> > > > stop_timer(timer-handle)
> > > >
> > > > Is there a way to implement such a design in linux?
> > > > or what could be the approach which fits my requirements most closely?
> > > Use Posix function:
> > > timer_create
> > > timer_settime
> > > etc.
> >
> > i was looking into butenhof's programming with posix threads book for
> > timer_create
> > and timer_settime. I tried to compile the code given in the book but
> > its showing undefined refernce to timer_create and timer_settime.
> >
> > the header files used in the code are :
> >
> > #include
> > #include
> > #include
> >
> > in my Makefile i am providing the link path for pthread library as
> > follows:
> > -L/usr/lib -pthread which is correct i suppose. 
> >
> > where are these functions timer_create() and timer_settime() defined?
> > > >
> > > > Thanks
> > > > Jasdeep