perl.ithreads
  Home Bitcoin Casinos 2022 FAQ Contact Sign in
perl.ithreads only
 
Advanced search
January 2010
motuwethfrsasuw
    123 53
45678910 1
11121314151617 2
18192021222324 3
25262728293031 4
2010
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2010 2008 2007 2006
total
perl.ithreads Profileā€¦
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  XS callbacks from different threads.         


Author: Josef Wolf
Date: Aug 1, 2008 17:59

Hello,

I am trying to write a XS module for a C library that creates its own
threads from which I have to pass callbacks back into perl.

Unfortunately, I am pretty much confused by the discussion of threads
in perlguts.

IIUC, I don't need to create multiple PerlInterpreter's. I just need
to set up the TLS properly in each thread. But it is not clear to me
how to do that.

From the perl point of view, this library would be used like this:

use Mylib;

if (Mylib::init()) { # this will create the additional threads

# Main thread returns immediately after creating background threads
# For now we only sit and wait until we get killed. In a future
# improvement we might periodically check for configuration
# changes and restart.
#
sleep (0);

Mylib::shutdown(); # Cleanup
}
Show full article (2.37Kb)
8 Comments
  Re: Thread::pool         


Author: Chris Fowler
Date: Jul 29, 2008 05:28

Where is scan_files()?

--
Chris Fowler
OutPost Sentinel, LLC
AIM: strtok2002
Support @ SIP/support@pbx.opsdc.com
or 678-804-8193
Email Support @ support@outpostsentinel.com
no comments
  Thread::pool         


Author: Javier
Date: Jul 29, 2008 05:23

Hi,

I have a problem with the module Thread::Pool-0.32.
I need to set my script as a daemon, but when i use this module the program
kill the threads.

The output of my script is:
Show full article (2.05Kb)
3 Comments
  Calling a object method in a create()         


Author: douglas
Date: Jul 14, 2008 07:22

Hi all,

I new on threads, but not so on perl.

I trying to execute a thread inside a object method of a class that I make to
consult SNMP quests and feed a rrddatabase.

The code bellow functions very nice.

---------------------
while(my ($id, $ep, $local, $tolerance, $lasterr, $hostscount) =
$sthLocals->fetchrow_array()) {
$self->localPolling($id, $ep, $local, $tolerance, $lasterr, $hostscount);
}
---------------------

But if I try to execute with a thread:

---------------------
while(my ($id, $ep, $local, $tolerance, $lasterr, $hostscount) =
$sthLocals->fetchrow_array()) {
my $thr = threads->create($self->localPooling, $id, $ep, $local, $tolerance,
$lasterr, $hostscount);
}
---------------------
Show full article (1.22Kb)
2 Comments
  environment variables         


Author: Danny H. Wong
Date: Jun 13, 2008 17:05

Hi All,
I have a script that set environment variables for 10 plus
configuration and each configuration share some environment variable and
have some different or specific environment variables for a particular
configuration. I set the env variables before calling each thread, but I
notice that the environment variable inherits the previous
configurations environment setting.
Example:
configure 1:
set 11 variables

Configure 2:
set 10 variables, all of of configure minus 1 specific variable

But configure 2 has all eleven variables.

Is there a way to delete the environment variables before setting each
configuration?

I tried
undef (%%ENV)
SETENV ();

but no luck?
Show full article (1.61Kb)
no comments
  Re: Memory usage         


Author: Jerry D. Hedden
Date: Jun 11, 2008 06:32

On Wed, Jun 11, 2008 at 9:26 AM, Javier Terceiro gmail.com> wrote:
> Hello list,
>
> I am designed a new software. I am using threads. The operation is
> correct, but memory consumption is excessive. The system is using 100
> MB and when the software is working, 500 Mb. The memory is not
> released, why?

You need to either join the threads after they're done working, or
else detach them. See below.
>
> The source code is:
>
> -----------------------------------------------------------------------------
>
> #!/usr/bin/perl -w
>
> use strict;
> use warnings;
> use AnyData;
> use Sys::Syslog;
> use...
Show full article (2.83Kb)
no comments
  Memory usage         


Author: Javier Terceiro
Date: Jun 11, 2008 06:26

Hello list,

I am designed a new software. I am using threads. The operation is
correct, but memory consumption is excessive. The system is using 100
MB and when the software is working, 500 Mb. The memory is not
released, why?

The source code is:

-----------------------------------------------------------------------------

#!/usr/bin/perl -w

use strict;
use warnings;
use AnyData;
use Sys::Syslog;
use Sys::Syslog qw(:DEFAULT setlogsock);
use Sys::Syslog qw(:standard :macros);
use POSIX qw(setsid);
use threads;
use threads::shared;
Show full article (2.44Kb)
1 Comment
  thread hash bug?         


Author: Danny H. Wong
Date: Jun 3, 2008 15:30

Hi GURUS,

I'm trying to created a hash of array inside a thread, but the hash
loses all its keys/values when leaving the function. Is there a bug in
using a hash inside a thread? Any ideas?

foreach my $i ( 1..3){

push (@BUILD_THREADS, threads->create(\©, $i));

}

foreach my $THREAD (@BUILD_THREADS)

{

my @DATA = $THREAD->join();

}

sub COPY

{

my ($i) = @_;

copy ( ${SOURCE}, "${DESTINATION}_${i}");

push @{$STORE_BUILD_RESULTS{"flintstones"}}, "${DESTINATION}_${i}";

while ( my ($KEY, $VALUE) = each (%%STORE_BUILD_RESULTS))

{

print "KEY, VALUE is $KEY, @$VALUE\n"; #I get correct print out.
Show full article (1.54Kb)
1 Comment
  Problem in build perl5.8.7 on OpenVMS using threads         


Author: Ravi Kumar
Date: May 16, 2008 00:32

Hi,

I am getting the fallowing error while building the perl5.8.7 on OpenVMS I64
v.8.3 system using threads
MMK
15-MAY-2008 16:40:40
15-MAY-2008 16:40:40
15-MAY-2008 16:40:40
CC/DECC/NOANSI_ALIAS
/Include...
Show full article (1.85Kb)
no comments
  Re: p5p summary: Improving threads::shared ?         


Author: Jerry D. Hedden
Date: May 4, 2008 05:21

Dean Arnold wrote:
> I've been pouring over the p5p archives trying to find
> what the subject p5p summary item is about, but wo/ any luck.
> Can someone point out the relevent thread title, or maybe
> summarize what "threads::shared could share aggregates
> properly with only Perl level changes to shared.pm"
> means ?

It means that something like this would DWIM:

my $x : shared;
$x = [ { 'complex' => 'aggregate' }, [ qw/ currently not sharable / ] ];

To do that now you'd have to do:

my $x : shared;
$x = &share;([]);
push(@$x, &share;({}), &share;([]));
$$x[0]{'complex'} = 'aggregate';
push(@{$$x[1]}, qw/ currently not sharable /);

The problem comes with copying complex structures:

my $x = [ { 'complex' => 'aggregate' }, [ qw/ currently not sharable / ] ];
Show full article (1.91Kb)
19 Comments
1 2 3 4 5 6 7 8 9