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

Re: Talarm() problem



> Here is a solution to the timeout problem. The strategy is as follows:
> 
> - when a timeout expires instead of disposing it, put it on a special
> list of expired timeouts
> - in add[root]timeout first check this list if there is a timeout that
> has the same process and function attached and reuse it
> - cancel[root]timeout looks at this list, too, as well as
> cancelalltimeouts
> 
> I think this is the only way to reliably prevent cancel[root]timeout
> from cancelling the wrong timeout. Since timeouts are normally used
> for periodically calling a certain function, add[root]timeout will
> always reuse the same timout structure and thus remove it from the
> list of expired timeouts. I have verified this by adding a function to
> print out this list, and everytime i checked it was empty.

WARNING!

Be very careful with this in respect to MintNet and perhaps ehscsi.
MintNet currently doesn't call cancelroottimeout() on a timeout that
has already expired (to avoid the problem this patch intends to fix).

Without changing MintNet this patch will cause memory leaks! If the
patches will go into futher releases of Mint (Eric?) then I will
change MintNet to don't check whether a timeout already expired and
always call cancelroottimeout.

Kay.