Re: regarding timeout/untimeout kernel functions

2004-07-23 Thread Peter Jeremy
[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 f

Re: regarding timeout/untimeout kernel functions

2004-07-22 Thread Joseph M Link
I dont know anything about the kevent timer stuff, so you should probably look into that before re-inventing the wheel. However, you would only need 1 thread to implement this timer functionality. There are a couple data structures you could use, but it would probably be easiest to use a prior

Re: regarding timeout/untimeout kernel functions

2004-07-22 Thread Bruce M Simpson
On Thu, Jul 22, 2004 at 09:56:00PM -0500, Dan Nelson wrote: > You could also use the kqueue/kevent functions to queue up an arbitrary > number of timer events in a single process. I wrote a small routing daemon which uses kqueue/kevent to fire a period timer on a quantum which in turn calls into a

Re: regarding timeout/untimeout kernel functions

2004-07-22 Thread Dan Nelson
In the last episode (Jul 22), pradeep reddy punnam said: > i thought of threading with select before , but i belive that if > the number of timers to be checked increases the number of the > threads to be maintained increses,so the process may become very > hevy. what do u think. Threads are very

Re: regarding timeout/untimeout kernel functions

2004-07-22 Thread pradeep reddy punnam
HI joseph , i thought of threading with select before , but i belive that if the number of timers to be checked increases the number of the threads to be maintained increses,so the process may become very hevy. what do u think. i think ultimatley i am going to use the above t

Re: regarding timeout/untimeout kernel functions

2004-07-22 Thread Joseph M Link
If you're willing to take some precautions, you could run the timer code with select/usleep in a separate thread. However, since the callbacks would originate from that thread, you would need mutexes to protect any data that the function accesses that could also be accessed by the normal progr

regarding timeout/untimeout kernel functions

2004-07-22 Thread pradeep reddy punnam
HI all, 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 but i need this in userland(application), and the execution of the function is time sensit