Re: [ROOT] - using TTimer and sockets.

From: mathes@ik3.fzk.de
Date: Tue Mar 27 2001 - 16:03:52 MEST


Hi,

well probably a thread for each timer means too much overhead, I am not
that experienced with threads.
What you need is obviously an individual timer connected with each socket,
so I see principially two possibilities:
1. Create and start a timer for each new socket message you send,
   if the timer expires, find the corresponding socket in a lookup table,
   if the message comes back before, stop the timer, find the timer in the
   lookup table
2. Create a new class which inherits from TSocket and has also a TTimer
   object in it, overwrite the Send() and Recv() method and do the timer
   handling there.
   Probably multiple inheritance will work also, but I don't know. Send()
   and Recv() methods of TSocket() should be virtual (in fact they are).
   The new class can be handled also by TMonitor you need only a 
   dynamic_cast<>() to handle the return value of TMonitor::Select()
   properly.

Solution 1 is what I would like to call the C-approach but eventually
easier to debug (and more difficult to read).
   
Ciao
  Hermann-Josef



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:40 MET