resetting timeout source




Hi, i m making an application which needs to perform a small task evey X secs, it will disconnect from a 
server if X seconds have passed without the aplication sending anything to the server, but if before 
completing the X secs i send something to the server i have to reset the timer for another X secs and so on 
like that all the time .... but my problem is that i can not find a way of resetting the timer without 
destroying and recreating the time again and again and again ..... which i find it too much for just the 
small task of resetting the timer, in other words i do not want to be freeing and getting new memory all the 
time i find that to be very inefficient and there should not be any need for it, so is there anyway to reset 
the timer without releasing its memory and getting memory all the time ? i know that if the callback function 
returns FALSE the source will not be added in the loop again so i guess i can just attach it again but that 
will only work when the timer expires so that will not help when the timer has not yet expired and i need to 
reset it for another  X secs. So should know that i m attaching the timer to a non default main loop (it is a 
main loop inside a thread). any ideas will be very helpful. thanks!!!
                                          


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]