Subject: [NSIS] A question about timer

From: Bo Gao <[email-masked]>
Date: Wed, 01 Mar 2006 10:04:07 -0500

Hello,
  I am a student of a Canadian University and trying to implement GIST 
right now. We are using Linux and C/C++. We know there are several 
timers in GIST like state timer and refresh timer and retransmission 
timer, which we must take care of. I checked our Linux(Fedora Core) 
system in our university and  found there is a timer_create system call 
supported in our Linux. Also we know that when the timer expires, it 
can send a signal.
We am planing to use only one Signal  Handler for all of the timers. In 
the Signal Handler, we are going to distinguish different signals and 
write something to a local pipe or fifo. So we can treat the local pipe 
or fifo as a member of a fdset, which should includes the RAW socket 
and all other sockets associated with Message Associations. So we can 
use select() in our main thread to detect all of messages(GIST message, 
timers).  Can anybody give some advices and suggestions as we are still 
in design phase?
Also the problem right now is there seems to be only two kinds of 
signals(USRSIG1, USRSIG2) we can use. But certainly,we have more than 
two types of timers.  Is it possible we can use something else rather 
than signal number to distinguish different timers?
Any comment will be very helpful.

  Sincerely,

Bo GaoE-mail: [email-masked]
Computer Science Dept, Concordia University, Montreal

_______________________________________________
nsis mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/nsis

---

From: Bernd Schloer <[email-masked]>
Date: Wed, 01 Mar 2006 20:37:11 +0100

Hi Bo,

I'm student at the University of Goettingen/Germany and we have made a GIST 
implementation. It's written in C/C++ and runs on Linux Platforms. You can have 
a look at the source code under http://user.informatik.uni-goettingen.de/~nsis/

I've written a short timer class which is based on double-linked lists. I use 
setitimer() to generate a signal. The signal handler searches the list for 
expired timers. The corresponding callback-function is then executed. With only 
one signal you can manage quite a lot of different timers.

Using select() is the second possibility to manage timers. Here you have to 
distinguish first if select() returned because of a socket or a timer event. The 
rest would be the same.

In our implementation you find the files Timer.cpp and Timer.h in the path 
nslp/nslp_api. In the path nslp/qos and nslp/natfw there are examples on how to 
use them.

Bye,
Bernd

Bo Gao wrote:
> supported in our Linux. Also we know that when the timer expires, it can 
> send a signal.
> or fifo as a member of a fdset, which should includes the RAW socket and 
> all other sockets associated with Message Associations. So we can use 
> select() in our main thread to detect all of messages(GIST message,