Re: rlm_perl CLONE/thread identification ?
On Sunday 08 October 2006 17:38, Jakub Wartak wrote: I want to obtain unique identified of each CLONE, because the goal is to create DB connection for each CLONE for performance reasons, the DBI object/handle AFAIK shouldn't be shared. Do it like that in main: our $dbh ; and then in CLONE sub CLONE { $dbh = DBI-connect(DBI:mysql:$database,$dbuser,$dbpass) or die $DBI::errstr; } then you will have number of connection equivalent to number of threads. Then in accouting, authenticate and so on just use $dbh and it should be unique per thread. -- Best Regards, Boian Jordanov SNE Orbitel - Next Generation Telecom tel. +359 2 4004 723 tel. +359 2 4004 002 - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
rlm_perl CLONE/thread identification ?
Hello group, I tried using use threads and quering by simple: my $id = threads-tid; But it always returns 0 ( meaning that the perl code is running under main() program ), but how do I identifiy each CLONE ?? I want to obtain unique identified of each CLONE, because the goal is to create DB connection for each CLONE for performance reasons, the DBI object/handle AFAIK shouldn't be shared. Maybe enumerating in sub CLONE() ?? Is this launching CLONE of perl module serialized ? And I could fetch current running CLONE id from authorize () ? wiki.freeradius.org states ( about CLONE() ): In this function you can initialize some variables that should be local for this thread. For example an Database connection. -- Jakub Wartak -vnull http://vnull.pcnet.com.pl/ - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html