Creating a timer within a module

Alejandro Pérez Méndez alex at um.es
Tue May 9 13:10:08 CEST 2017


>>
>>>    You should create a thread in the modules initialization 
>>> routine.  Then, call radius_event_list_corral() to get the main 
>>> server event list.
>>>
>>>    That thread can do updates.
>>
>> Thanks. I'll look into it. I didn't want to make changes to 
>> rlm_realm, just to trustrouter.c. But if I need to create the thread 
>> there, so be it.
>
> Hi Alan,
>
> I've been trying to make this work, but I'm sure I'm doing something 
> wrong. When you say "You should create a thread in the modules 
> initialization routine." do you mean by using pthread_create() 
> directly or by using any of the thread primitives FR has (although 
> those seem to be intended only for handling REQUEST* objects).
>
> I've also tried without creating a thread, but then the event's 
> callback seems to be called from the main server thread, precluding 
> other tasks to be executed until the callback is finished.
> Even with a thread, how do I make events to be handled by that thread? 
> Or should the event trigger the execution of a thread?

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?

Thanks
>
> Thanks,
> Alejandro



More information about the Freeradius-Devel mailing list