Creating a timer within a module

Alejandro Pérez Méndez alex at um.es
Wed May 10 17:39:34 CEST 2017


>> On May 9, 2017, at 7:10 AM, Alejandro Pérez Méndez <alex at um.es> wrote:
>>> Ok I think I got it. Was your suggestion to use the event list for 
>>> having the timer functionality, but then on the event handler 
>>> start/use a custom thread for performing the lengthy operation?
>>    If the work to be done is small, it can just use the main thread, 
>> and the main event loop.
>>
>>    If the work to be done is large, the module should start it's own 
>> thread, and use it's own event loop.
> Thanks. My case would be the second one, so would not need to call 
> radius_event_list_corral() as a new event loop must be created.

It seems that an event loop do not serve my purposes, as it is not 
thread-safe and I will be inserting from the REQUEST thread pool, 
whereas consuming from the rekeyer thread (the one I create for my 
module). I can obviously add a mutex but then REQUESTS handling might be 
blocked for as long as a rekey can last (which is what I wanted to avoid 
in the first place).

Would it be ok for FR standards to use a HEAP directly and have my 
rekeyer thread consuming data from the HEAP and performing the specific 
task of rekeying? In that way I can separate extracting from the HEAP 
(mutex protected) than executing the rekey (does not need to be protected).

I'm asking since I will eventually want this code to be merged, so I'd 
better know beforehand :).

Alejandro


>
> Alejandro
>
>>
>>    Alan DeKok.
>>
>>
>> -
>> List info/subscribe/unsubscribe? See 
>> http://www.freeradius.org/list/devel.html
>
> -
> List info/subscribe/unsubscribe? See 
> http://www.freeradius.org/list/devel.html



More information about the Freeradius-Devel mailing list