hi: thanks for all the hint. after testing at freeradius 3.0.4, I found threads::shared works as expected. if I don't use threads::shared the global variable can be seen at every thread, but if thread A modify the variable then thread B won't see it. and this is the first time I heard about "CLONE_SKIP" function.. 2015-04-26 1:13 GMT+08:00 Peter Banksia ok <balsianok.peter@gmail.com>:
On 25 Apr 2015, at 18:14, Eugene Grosbein <fr@grosbein.net> wrote:
On Sat, Apr 25, 2015 at 10:46:05AM +0800, d tbsky wrote: hi: I am writing rlm_perl script under freeradius 3.0.4 which comes with RHEL 7.1. and I am confused about how thread working with rlm_perl. according to the old message at email list, if I want every radius thread to have their own unique variable, I should put the variable at "CLONE" function like below:
our ($var); CLONE { $var = ''; }
but after testing, I found even if the variable is not put at the CLONE function, they are still unique to each thread. may I ask what is the correct method to make global thread shared variable and thread unique variable under rlm_perl ?
All variables are thread unique unless explicitly decrlared ":shared", e.g.:
You are not right. I use rlm_perl module without use threads or use threads::share just
our %cache;
Each radius thread has access to this global variable or can modified it
For me that means, freeradius create only one perl instance, which is shared between radius threads.