Result:
found more than 468 distributions - search limited to the first 2001 files matching your query ( run in 0.752 )


AnyEvent-Fork-Pool

 view release on metacpan or  search on metacpan

Pool.pm  view on Meta::CPAN


=item ($cpus, $eus) = AnyEvent::Fork::Pool::ncpu [$default_cpus]

Tries to detect the number of CPUs (C<$cpus> often called CPU cores
nowadays) and execution units (C<$eus>) which include e.g. extra
hyperthreaded units). When C<$cpus> cannot be determined reliably,
C<$default_cpus> is returned for both values, or C<1> if it is missing.

For normal CPU bound uses, it is wise to have as many worker processes
as CPUs in the system (C<$cpus>), if nothing else uses the CPU. Using
hyperthreading is usually detrimental to performance, but in those rare
cases where that really helps it might be beneficial to use more workers
(C<$eus>).

Currently, F</proc/cpuinfo> is parsed on GNU/Linux systems for both
C<$cpus> and C<$eus>, and on {Free,Net,Open}BSD, F<sysctl -n hw.ncpu> is

 view all matches for this distribution


AnyEvent-Fork-RPC

 view release on metacpan or  search on metacpan

RPC.pm  view on Meta::CPAN

L<AnyEvent>, but also L<IO::AIO>, or L<Tk> for example.

=head2 Example 3: Asynchronous backend with Coro

With L<Coro> you can create a nice asynchronous backend implementation by
defining an rpc server function that creates a new Coro thread for every
request that calls a function "normally", i.e. the parameters from the
parent process are passed to it, and any return values are returned to the
parent process, e.g.:

   package My::Arith;

RPC.pm  view on Meta::CPAN

      Coro::async_pool {
         $done->($func->(@arg));
      };
   }

The C<run> function creates a new thread for every invocation, using the
first argument as function name, and calls the C<$done> callback on it's
return values. This makes it quite natural to define the C<add> and C<mul>
functions to add or multiply two numbers and return the result.

Since this is the asynchronous backend, it's quite possible to define RPC

RPC.pm  view on Meta::CPAN

If C<async> was true, then the C<$function> receives an additional
initial argument, the result callback. In this case, returning from
C<$function> does nothing - the function only counts as "done" when the
result callback is called, and any arguments passed to it are considered
the return values. This makes it possible to "return" from event handlers
or e.g. Coro threads.

The other thing that can be done with the RPC object is to destroy it. In
this case, the child process will execute all remaining RPC calls, report
their results, and then exit.

RPC.pm  view on Meta::CPAN

are queued and the jobs are slow, they will all run concurrently. The
child must implement some queueing/limiting mechanism if this causes
problems. Alternatively, the parent could limit the amount of rpc calls
that are outstanding.

Blocking use of condvars is not supported (in the main thread, outside of
e.g. L<Coro> threads).

Using event-based modules such as L<IO::AIO>, L<Gtk2>, L<Tk> and so on is
easy.

=back

 view all matches for this distribution


AnyEvent-FriendFeed-Realtime

 view release on metacpan or  search on metacpan

inc/Test/Builder.pm  view on Meta::CPAN

        require Test::Builder::IO::Scalar;
    }
}


# Make Test::Builder thread-safe for ithreads.
BEGIN {
    use Config;
    # Load threads::shared when threads are turned on.
    # 5.8.0's threads are so busted we no longer support them.
    if( $] >= 5.008001 && $Config{useithreads} && $INC{'threads.pm'} ) {
        require threads::shared;

        # Hack around YET ANOTHER threads::shared bug.  It would
        # occasionally forget the contents of the variable when sharing it.
        # So we first copy the data, then share, then put our copy back.
        *share = sub (\[$@%]) {
            my $type = ref $_[0];
            my $data;

inc/Test/Builder.pm  view on Meta::CPAN

            }
            else {
                die( "Unknown type: " . $type );
            }

            $_[0] = &threads::shared::share( $_[0] );

            if( $type eq 'HASH' ) {
                %{ $_[0] } = %$data;
            }
            elsif( $type eq 'ARRAY' ) {

inc/Test/Builder.pm  view on Meta::CPAN

            }

            return $_[0];
        };
    }
    # 5.8.0's threads::shared is busted when threads are off
    # and earlier Perls just don't have that module at all.
    else {
        *share = sub { return $_[0] };
        *lock  = sub { 0 };
    }

inc/Test/Builder.pm  view on Meta::CPAN

            $self->{Expected_Tests} = $self->{Curr_Test};
        }

        # Auto-extended arrays and elements which aren't explicitly
        # filled in with a shared reference will puke under 5.8.0
        # ithreads.  So we have to fill them in by hand. :(
        my $empty_result = &share( {} );
        for my $idx ( 0 .. $self->{Expected_Tests} - 1 ) {
            $test_results->[$idx] = $empty_result
              unless defined $test_results->[$idx];
        }

 view all matches for this distribution


AnyEvent-GDB

 view release on metacpan or  search on metacpan

GDB.pm  view on Meta::CPAN

This is purely a convenience method for small scripts: since it blocks
execution using a condvar, it is not suitable to be used inside callbacks
or modules.

That is, unless L<Coro> is used - with Coro, you can run multiple
C<cmd_sync> methods concurrently form multiple threads, with no issues.

=cut

sub cmd_sync {
   push @_, my $cv = AE::cv;

GDB.pm  view on Meta::CPAN

   $cb = $self->    {"on_$event"} and $cb->($self, $event, @args);
}

# predefined events

sub on_notify_thread_group_added {
   my ($self, undef, $r) = @_;

   $self->{thread_group}{$r->{id}} = $r;
}

sub on_notify_thread_group_removed {
   my ($self, undef, $r) = @_;

   delete $self->{thread_group}{$r->{id}};
}

sub on_notify_thread_group_started {
   my ($self, undef, $r) = @_;

   delete $self->{thread_group}{exit_code};
   $self->{thread_group}{$r->{id}}{pid} = $r->{pid};
}

sub on_notify_thread_group_exited {
   my ($self, undef, $r) = @_;

   delete $self->{thread_group}{pid};
   $self->{thread_group}{$r->{id}}{exit_code} = $r->{exit_code};
}

sub on_notify_record_started {
   my ($self, undef, $r) = @_;

   $self->{thread_group}{$r->{id}}{recording} = 1;
}

sub on_notify_record_stopped {
   my ($self, undef, $r) = @_;

   $self->{thread_group}{$r->{id}}{recording} = 0;
}

sub on_notify_thread_created {
   my ($self, undef, $r) = @_;

   $self->{thread}{$r->{id}} = $r;
}

sub on_notify_thread_exited {
   my ($self, undef, $r) = @_;

   delete $self->{thread}{$r->{id}};
}

sub _threads {
   my ($self, $id) = @_;

   ref $id
      ? @{ $self->{thread} }{@$id}
      : $id eq "all"
         ? values %{ $self->{thread} }
         : $self->{thread}{$id}
}

sub on_exec_running {
   my ($self, undef, $r) = @_;

   for ($self->_threads ($r->{thread_id})) {
      delete $_->{stopped};
      $_->{running} = 1;
   }
}

sub on_exec_stopped {
   my ($self, undef, $r) = @_;

   for ($self->_threads ($r->{stopped_threads})) {
      delete $_->{running};
      $_->{stopped} = $r;
   }

#   $self->event ("thread_$r->{reason}" => $r, [map $_->{id}, $self->_threads ($r)]);
}

sub _thread_groups {
   my ($self, $r) = @_;

   exists $r->{thread_group}
      ? $self->{thread_group}{$r->{thread_group}}
      : values %{ $self->{thread_group} }
}

sub on_notify_library_loaded {
   my ($self, undef, $r) = @_;

   $_->{library}{$r->{id}} = $r
      for $self->_thread_groups ($r);
}

sub on_notify_library_unloaded {
   my ($self, undef, $r) = @_;

   delete $_->{library}{$r->{id}}
      for $self->_thread_groups ($r);
}

=back

=head2 EVENTS

GDB.pm  view on Meta::CPAN


=back

=head2 STATUS STORAGE

The default implementations of the event method store the thread,
thread_group, recording, library and running status insid ethe C<$gdb>
object.

You can access these at any time. Specifically, the following information
is available:

=over 4

=item C<< $gdb->{thread_group}{I<id>} >>

The C<thread_group> member stores a hash for each existing thread
group. The hash always contains the C<id> member, but might also contain
other members.

=item C<< $gdb->{thread_group}{I<id>}{pid} >>

The C<pid> member only exists while the thread group is running a program,
and contaisn the PID of the program.

=item C<< $gdb->{thread_group}{I<id>}{exit_code} >>

The C<exit_code> member only exists after a program has finished
executing, and before it is started again, and contains the exit code of
the program.

=item C<< $gdb->{thread_group}{I<id>}{recording} >>

The C<recording> member only exists if recording has been previously
started, and is C<1> if recoridng is currently active, and C<0> if it has
been stopped again.

=item C<< $gdb->{thread}{I<id>} >>

The C<thread> member stores a hash for each existing thread. The hash
always contains the C<id> member with the thread id, and the C<group_id>
member with the corresponding thread group id.

=item C<< $gdb->{thread}{I<id>}{running} >>

The C<running> member is C<1> while the thread is, well, running, and is
missing otherwise.

=item C<< $gdb->{thread}{I<id>}{stopped} >>

The C<stopped> member contains the result list from the C<on_exec_stopped>
notification that caused the thread to stop, and only exists when the
thread is topped.

=item C<< $gdb->{library}{I<id>} >>

The C<library> member contains all results from the C<on_library_loaded>
event (such as C<id>, C<target_name>, C<host_name> and potentially a
C<thread_group>.

=back

=head1 SEE ALSO

 view all matches for this distribution


AnyEvent-Gearman

 view release on metacpan or  search on metacpan

inc/Test/Builder.pm  view on Meta::CPAN

        require Test::Builder::IO::Scalar;
    }
}


# Make Test::Builder thread-safe for ithreads.
BEGIN {
    use Config;
    # Load threads::shared when threads are turned on.
    # 5.8.0's threads are so busted we no longer support them.
    if( $] >= 5.008001 && $Config{useithreads} && $INC{'threads.pm'} ) {
        require threads::shared;

        # Hack around YET ANOTHER threads::shared bug.  It would
        # occasionally forget the contents of the variable when sharing it.
        # So we first copy the data, then share, then put our copy back.
        *share = sub (\[$@%]) {
            my $type = ref $_[0];
            my $data;

inc/Test/Builder.pm  view on Meta::CPAN

            }
            else {
                die( "Unknown type: " . $type );
            }

            $_[0] = &threads::shared::share( $_[0] );

            if( $type eq 'HASH' ) {
                %{ $_[0] } = %$data;
            }
            elsif( $type eq 'ARRAY' ) {

inc/Test/Builder.pm  view on Meta::CPAN

            }

            return $_[0];
        };
    }
    # 5.8.0's threads::shared is busted when threads are off
    # and earlier Perls just don't have that module at all.
    else {
        *share = sub { return $_[0] };
        *lock  = sub { 0 };
    }

inc/Test/Builder.pm  view on Meta::CPAN

            $self->{Expected_Tests} = $self->{Curr_Test};
        }

        # Auto-extended arrays and elements which aren't explicitly
        # filled in with a shared reference will puke under 5.8.0
        # ithreads.  So we have to fill them in by hand. :(
        my $empty_result = &share( {} );
        for my $idx ( 0 .. $self->{Expected_Tests} - 1 ) {
            $test_results->[$idx] = $empty_result
              unless defined $test_results->[$idx];
        }

 view all matches for this distribution


AnyEvent-Gmail-Feed

 view release on metacpan or  search on metacpan

inc/Test/Builder.pm  view on Meta::CPAN

use strict;

our $VERSION = '0.80';
$VERSION = eval { $VERSION }; # make the alpha version come out as a number

# Make Test::Builder thread-safe for ithreads.
BEGIN {
    use Config;
    # Load threads::shared when threads are turned on.
    # 5.8.0's threads are so busted we no longer support them.
    if( $] >= 5.008001 && $Config{useithreads} && $INC{'threads.pm'}) {
        require threads::shared;

        # Hack around YET ANOTHER threads::shared bug.  It would 
        # occassionally forget the contents of the variable when sharing it.
        # So we first copy the data, then share, then put our copy back.
        *share = sub (\[$@%]) {
            my $type = ref $_[0];
            my $data;

inc/Test/Builder.pm  view on Meta::CPAN

            }
            else {
                die("Unknown type: ".$type);
            }

            $_[0] = &threads::shared::share($_[0]);

            if( $type eq 'HASH' ) {
                %{$_[0]} = %$data;
            }
            elsif( $type eq 'ARRAY' ) {

inc/Test/Builder.pm  view on Meta::CPAN

            }

            return $_[0];
        };
    }
    # 5.8.0's threads::shared is busted when threads are off
    # and earlier Perls just don't have that module at all.
    else {
        *share = sub { return $_[0] };
        *lock  = sub { 0 };
    }

inc/Test/Builder.pm  view on Meta::CPAN

            $self->{Expected_Tests} = $self->{Curr_Test};
        }

        # Auto-extended arrays and elements which aren't explicitly
        # filled in with a shared reference will puke under 5.8.0
        # ithreads.  So we have to fill them in by hand. :(
        my $empty_result = &share({});
        for my $idx ( 0..$self->{Expected_Tests}-1 ) {
            $test_results->[$idx] = $empty_result
              unless defined $test_results->[$idx];
        }

 view all matches for this distribution


AnyEvent-Groonga

 view release on metacpan or  search on metacpan

inc/Test/More.pm  view on Meta::CPAN

    # sorted with the same algorithm.
    #
    # Ensure that references are not accidentally treated the same as a
    # string containing the reference.
    #
    # Have to inline the sort routine due to a threading/sort bug.
    # See [rt.cpan.org 6782]
    #
    # I don't know how references would be sorted so we just don't sort
    # them.  This means eq_set doesn't really work with refs.
    return eq_array(

 view all matches for this distribution


AnyEvent-JSONRPC-Lite

 view release on metacpan or  search on metacpan

inc/Test/Builder.pm  view on Meta::CPAN

        require Test::Builder::IO::Scalar;
    }
}


# Make Test::Builder thread-safe for ithreads.
BEGIN {
    use Config;
    # Load threads::shared when threads are turned on.
    # 5.8.0's threads are so busted we no longer support them.
    if( $] >= 5.008001 && $Config{useithreads} && $INC{'threads.pm'} ) {
        require threads::shared;

        # Hack around YET ANOTHER threads::shared bug.  It would
        # occasionally forget the contents of the variable when sharing it.
        # So we first copy the data, then share, then put our copy back.
        *share = sub (\[$@%]) {
            my $type = ref $_[0];
            my $data;

inc/Test/Builder.pm  view on Meta::CPAN

            }
            else {
                die( "Unknown type: " . $type );
            }

            $_[0] = &threads::shared::share( $_[0] );

            if( $type eq 'HASH' ) {
                %{ $_[0] } = %$data;
            }
            elsif( $type eq 'ARRAY' ) {

inc/Test/Builder.pm  view on Meta::CPAN

            }

            return $_[0];
        };
    }
    # 5.8.0's threads::shared is busted when threads are off
    # and earlier Perls just don't have that module at all.
    else {
        *share = sub { return $_[0] };
        *lock  = sub { 0 };
    }

inc/Test/Builder.pm  view on Meta::CPAN

            $self->{Expected_Tests} = $self->{Curr_Test};
        }

        # Auto-extended arrays and elements which aren't explicitly
        # filled in with a shared reference will puke under 5.8.0
        # ithreads.  So we have to fill them in by hand. :(
        my $empty_result = &share( {} );
        for my $idx ( 0 .. $self->{Expected_Tests} - 1 ) {
            $test_results->[$idx] = $empty_result
              unless defined $test_results->[$idx];
        }

 view all matches for this distribution


AnyEvent-JSONRPC

 view release on metacpan or  search on metacpan

inc/Test/Builder.pm  view on Meta::CPAN

        require Test::Builder::IO::Scalar;
    }
}


# Make Test::Builder thread-safe for ithreads.
BEGIN {
    use Config;
    # Load threads::shared when threads are turned on.
    # 5.8.0's threads are so busted we no longer support them.
    if( $] >= 5.008001 && $Config{useithreads} && $INC{'threads.pm'} ) {
        require threads::shared;

        # Hack around YET ANOTHER threads::shared bug.  It would
        # occassionally forget the contents of the variable when sharing it.
        # So we first copy the data, then share, then put our copy back.
        *share = sub (\[$@%]) {
            my $type = ref $_[0];
            my $data;

inc/Test/Builder.pm  view on Meta::CPAN

            }
            else {
                die( "Unknown type: " . $type );
            }

            $_[0] = &threads::shared::share( $_[0] );

            if( $type eq 'HASH' ) {
                %{ $_[0] } = %$data;
            }
            elsif( $type eq 'ARRAY' ) {

inc/Test/Builder.pm  view on Meta::CPAN

            }

            return $_[0];
        };
    }
    # 5.8.0's threads::shared is busted when threads are off
    # and earlier Perls just don't have that module at all.
    else {
        *share = sub { return $_[0] };
        *lock  = sub { 0 };
    }

inc/Test/Builder.pm  view on Meta::CPAN

            $self->{Expected_Tests} = $self->{Curr_Test};
        }

        # Auto-extended arrays and elements which aren't explicitly
        # filled in with a shared reference will puke under 5.8.0
        # ithreads.  So we have to fill them in by hand. :(
        my $empty_result = &share( {} );
        for my $idx ( 0 .. $self->{Expected_Tests} - 1 ) {
            $test_results->[$idx] = $empty_result
              unless defined $test_results->[$idx];
        }

 view all matches for this distribution


AnyEvent-KVStore-Etcd

 view release on metacpan or  search on metacpan

lib/AnyEvent/KVStore/Etcd.pm  view on Meta::CPAN


One option, though it does incur significant startup cost, is to use L<Coro>
and move the callback from a C<sub {}> call to an C<unblock_sub {}> call.  This
is probably the simplest approach and it works.  In general you get sequential
ordering but this is not a hard guarantee.  Another approach might be to move
processing into worker threads.

=head1 ATTRIBUTES/ACCESSORS

If accessing the module directly, the following accessors are available.  These
are not generally needed and are mostly used internally for managing the

 view all matches for this distribution


AnyEvent-MP

 view release on metacpan or  search on metacpan

MP.pm  view on Meta::CPAN


This is not a philosophical difference, but simply stems from AnyEvent::MP
being event-based, while Erlang is process-based.

You can have a look at L<Coro::MP> for a more Erlang-like process model on
top of AEMP and Coro threads.

=item * Erlang sends are synchronous, AEMP sends are asynchronous.

Sending messages in Erlang is synchronous and blocks the process until
a connection has been established and the message sent (and so does not

 view all matches for this distribution


AnyEvent-MySQL

 view release on metacpan or  search on metacpan

lib/AnyEvent/MySQL.pm  view on Meta::CPAN

                }
            },
        );

        AnyEvent::MySQL::Imp::do_auth($wdbh->{_}[HDi], $wdbh->{Username}, $wdbh->{_}[AUTHi], $param->{database}, sub {
            my($success, $err_num_and_msg, $thread_id) = @_;
            return if !$wdbh;
            if( $success ) {
                $wdbh->{mysql_thread_id} = $thread_id;
                $cb->($wdbh, guard {
                    _process_task($wdbh) if $wdbh;
                });
            }
            else {

 view all matches for this distribution


AnyEvent-Net-Curl-Queued

 view release on metacpan or  search on metacpan

eg/queue  view on Meta::CPAN

http://localhost/manual/pt-br/caching.html
http://localhost/manual/pt-br/mod/mod_so.html
http://localhost/manual/fr/mod/beos.html
http://localhost/manual/zh-cn/mod/mod_mime.html
http://localhost/manual/es/howto/htaccess.html
http://localhost/manual/es/developer/thread_safety.html
http://localhost/manual/es/sections.html
http://localhost/manual/tr/mod/mpm_common.html
http://localhost/manual/en/mod/mod_rewrite.html
http://localhost/manual/fr/mod/mod_setenvif.html
http://localhost/manual/zh-cn/mod/mpm_winnt.html

eg/queue  view on Meta::CPAN

http://localhost/manual/pt-br/mod/mod_nw_ssl.html
http://localhost/manual/zh-cn/mod/mod_proxy_http.html
http://localhost/manual/ja/mod/mpm_common.html
http://localhost/manual/ko/misc/relevant_standards.html
http://localhost/manual/zh-cn/vhosts/mass.html
http://localhost/manual/de/developer/thread_safety.html
http://localhost/manual/fr/mod/mod_authn_dbd.html
http://localhost/manual/es/vhosts/ip-based.html
http://localhost/manual/tr/handler.html
http://localhost/manual/zh-cn/platform/netware.html
http://localhost/manual/de/rewrite/advanced.html

eg/queue  view on Meta::CPAN

http://localhost/manual/zh-cn/vhosts/name-based.html
http://localhost/manual/en/rewrite/proxy.html
http://localhost/manual/ja/developer/documenting.html
http://localhost/manual/de/mod/worker.html
http://localhost/manual/es/index.html
http://localhost/manual/zh-cn/developer/thread_safety.html
http://localhost/manual/es/mod/mod_authn_dbm.html
http://localhost/manual/zh-cn/platform/index.html
http://localhost/manual/de/programs/configure.html
http://localhost/manual/ja/mpm.html
http://localhost/manual/ja/mod/mod_authz_default.html

eg/queue  view on Meta::CPAN

http://localhost/manual/en/mod/mod_version.html
http://localhost/manual/en/mod/mod_authz_default.html
http://localhost/manual/tr/logs.html
http://localhost/manual/fr/programs/htdbm.html
http://localhost/manual/ja/programs/httxt2dbm.html
http://localhost/manual/en/developer/thread_safety.html
http://localhost/manual/fr/mod/mod_authz_user.html
http://localhost/manual/tr/mod/mod_proxy_http.html
http://localhost/manual/fr/content-negotiation.html
http://localhost/manual/de/programs/suexec.html
http://localhost/manual/tr/env.html

eg/queue  view on Meta::CPAN

http://localhost/manual/fr/mod/mod_ldap.html
http://localhost/manual/en/mod/mod_substitute.html
http://localhost/manual/es/howto/public_html.html
http://localhost/manual/ja/rewrite/advanced.html
http://localhost/manual/ko/developer/documenting.html
http://localhost/manual/tr/developer/thread_safety.html
http://localhost/manual/de/mod/mod_authz_dbm.html
http://localhost/manual/zh-cn/sections.html
http://localhost/manual/pt-br/mod/event.html
http://localhost/manual/ko/misc/index.html
http://localhost/manual/en/programs/dbmmanage.html

 view all matches for this distribution


AnyEvent-Pcap

 view release on metacpan or  search on metacpan

inc/Test/Builder.pm  view on Meta::CPAN

        require Test::Builder::IO::Scalar;
    }
}


# Make Test::Builder thread-safe for ithreads.
BEGIN {
    use Config;
    # Load threads::shared when threads are turned on.
    # 5.8.0's threads are so busted we no longer support them.
    if( $] >= 5.008001 && $Config{useithreads} && $INC{'threads.pm'} ) {
        require threads::shared;

        # Hack around YET ANOTHER threads::shared bug.  It would
        # occasionally forget the contents of the variable when sharing it.
        # So we first copy the data, then share, then put our copy back.
        *share = sub (\[$@%]) {
            my $type = ref $_[0];
            my $data;

inc/Test/Builder.pm  view on Meta::CPAN

            }
            else {
                die( "Unknown type: " . $type );
            }

            $_[0] = &threads::shared::share( $_[0] );

            if( $type eq 'HASH' ) {
                %{ $_[0] } = %$data;
            }
            elsif( $type eq 'ARRAY' ) {

inc/Test/Builder.pm  view on Meta::CPAN

            }

            return $_[0];
        };
    }
    # 5.8.0's threads::shared is busted when threads are off
    # and earlier Perls just don't have that module at all.
    else {
        *share = sub { return $_[0] };
        *lock  = sub { 0 };
    }

inc/Test/Builder.pm  view on Meta::CPAN

            $self->{Expected_Tests} = $self->{Curr_Test};
        }

        # Auto-extended arrays and elements which aren't explicitly
        # filled in with a shared reference will puke under 5.8.0
        # ithreads.  So we have to fill them in by hand. :(
        my $empty_result = &share( {} );
        for my $idx ( 0 .. $self->{Expected_Tests} - 1 ) {
            $test_results->[$idx] = $empty_result
              unless defined $test_results->[$idx];
        }

 view all matches for this distribution


AnyEvent-Retry

 view release on metacpan or  search on metacpan

lib/AnyEvent/Retry/Coro.pm  view on Meta::CPAN

package AnyEvent::Retry::Coro;
BEGIN {
  $AnyEvent::Retry::Coro::VERSION = '0.03';
}
# ABSTRACT: AnyEvent::Retry for jobs that run in separate threads
use Moose;
use Coro;
use Scalar::Util qw(weaken);
use Try::Tiny;

lib/AnyEvent/Retry/Coro.pm  view on Meta::CPAN


=pod

=head1 NAME

AnyEvent::Retry::Coro - AnyEvent::Retry for jobs that run in separate threads

=head1 VERSION

version 0.03

lib/AnyEvent/Retry/Coro.pm  view on Meta::CPAN


=head1 METHODS

=head2 run

This runs the task, blocking the thread until a result is available.
If your task encounters an error, this will die.  If it's sucessful,
it returns the result.

=head2 wait

 view all matches for this distribution


AnyEvent-ReverseHTTP

 view release on metacpan or  search on metacpan

inc/Test/Builder.pm  view on Meta::CPAN

        require Test::Builder::IO::Scalar;
    }
}


# Make Test::Builder thread-safe for ithreads.
BEGIN {
    use Config;
    # Load threads::shared when threads are turned on.
    # 5.8.0's threads are so busted we no longer support them.
    if( $] >= 5.008001 && $Config{useithreads} && $INC{'threads.pm'} ) {
        require threads::shared;

        # Hack around YET ANOTHER threads::shared bug.  It would
        # occassionally forget the contents of the variable when sharing it.
        # So we first copy the data, then share, then put our copy back.
        *share = sub (\[$@%]) {
            my $type = ref $_[0];
            my $data;

inc/Test/Builder.pm  view on Meta::CPAN

            }
            else {
                die( "Unknown type: " . $type );
            }

            $_[0] = &threads::shared::share( $_[0] );

            if( $type eq 'HASH' ) {
                %{ $_[0] } = %$data;
            }
            elsif( $type eq 'ARRAY' ) {

inc/Test/Builder.pm  view on Meta::CPAN

            }

            return $_[0];
        };
    }
    # 5.8.0's threads::shared is busted when threads are off
    # and earlier Perls just don't have that module at all.
    else {
        *share = sub { return $_[0] };
        *lock  = sub { 0 };
    }

inc/Test/Builder.pm  view on Meta::CPAN

            $self->{Expected_Tests} = $self->{Curr_Test};
        }

        # Auto-extended arrays and elements which aren't explicitly
        # filled in with a shared reference will puke under 5.8.0
        # ithreads.  So we have to fill them in by hand. :(
        my $empty_result = &share( {} );
        for my $idx ( 0 .. $self->{Expected_Tests} - 1 ) {
            $test_results->[$idx] = $empty_result
              unless defined $test_results->[$idx];
        }

 view all matches for this distribution


AnyEvent-Run

 view release on metacpan or  search on metacpan

lib/AnyEvent/Run.pm  view on Meta::CPAN


When launching an external command, using an arrayref is recommended so
that your command is properly escaped.

Take care when using coderefs on Windows, as your code will run in
a thread.  Avoid using modules that are not thread-safe.

=item args

Optional. Arrayref of arguments to be passed to cmd.

 view all matches for this distribution


AnyEvent-Subprocess

 view release on metacpan or  search on metacpan

lib/AnyEvent/Subprocess/Done/Delegate/State.pm  view on Meta::CPAN

package AnyEvent::Subprocess::Done::Delegate::State;
BEGIN {
  $AnyEvent::Subprocess::Done::Delegate::State::VERSION = '1.102912';
}
# ABSTRACT: thread state through the job/run/done lifecycle
use Moose;

with 'AnyEvent::Subprocess::Done::Delegate';

has 'state' => ( is => 'ro', isa => 'HashRef', required => 1 );

lib/AnyEvent/Subprocess/Done/Delegate/State.pm  view on Meta::CPAN


=pod

=head1 NAME

AnyEvent::Subprocess::Done::Delegate::State - thread state through the job/run/done lifecycle

=head1 VERSION

version 1.102912

 view all matches for this distribution


AnyEvent-Task

 view release on metacpan or  search on metacpan

lib/AnyEvent/Task.pm  view on Meta::CPAN


=head1 STARTING THE SERVER

Typically you will want to start the client and server as completely separate processes as shown in the synopses.

Running the server and the client in the same process is technically possible but is highly discouraged since the server will C<fork()> when the client demands a new worker process. In this case, all descriptors in use by the client are duped into th...

Since it's more of a bother than it's worth to run the server and the client in the same process, there is an alternate server constructor, C<AnyEvent::Task::Server::fork_task_server> for when you'd like to fork a dedicated server process. It can be ...

    ## my ($keepalive_pipe, $server_pid) =
    AnyEvent::Task::Server::fork_task_server(

lib/AnyEvent/Task.pm  view on Meta::CPAN


If C<AnyEvent::Task::Server::fork_task_server> is called in a void context then the reference to this keep-alive pipe is pushed onto C<@AnyEvent::Task::Server::children_sockets>. Otherwise, the keep-alive pipe and the server's PID are returned. Closi...

Since the C<fork_task_server> constructor calls fork and requires using AnyEvent in both the parent and child processes, it is important that you not install any AnyEvent watchers before calling it. The usual caveats about forking AnyEvent processes ...

You should also not call C<fork_task_server> after having started threads since, again, this function calls fork. Forking a threaded process is dangerous because the threads might have userspace data-structures in inconsistent states at the time of t...





 view all matches for this distribution


AnyEvent-Twitter-Stream

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.05  Wed Aug 26 16:31:52 PDT 2009
        - Unbreak the refcount stuff introduced in 0.03
        - BACKWARD INCOMPATIBLE: method names should now be either 'firehose', 'sample' or 'filter'
          per Twitter API update.
          http://groups.google.com/group/twitter-development-talk/browse_frm/thread/44bd32155dbf2c16

0.04  Wed Aug 26 01:59:30 PDT 2009
        - test_requires Test::TCP

0.03  Tue Aug 25 19:08:29 PDT 2009

 view all matches for this distribution


AnyEvent-Twitter

 view release on metacpan or  search on metacpan

inc/Test/More.pm  view on Meta::CPAN

    # sorted with the same algorithm.
    #
    # Ensure that references are not accidentally treated the same as a
    # string containing the reference.
    #
    # Have to inline the sort routine due to a threading/sort bug.
    # See [rt.cpan.org 6782]
    #
    # I don't know how references would be sorted so we just don't sort
    # them.  This means eq_set doesn't really work with refs.
    return eq_array(

 view all matches for this distribution


AnyEvent-XMPP

 view release on metacpan or  search on metacpan

lib/AnyEvent/XMPP.pm  view on Meta::CPAN

(aka Jabber) modules out there is the support for L<AnyEvent>. L<AnyEvent>
permits you to use this module together with other I/O event based programs and
libraries (ie. L<Gtk2> or L<Event>).

The other modules could often only be integrated in those applications or
libraries by using threads. I decided to write this module because I think CPAN
lacks an event based XMPP module. Threads are unfortunately not an alternative
in Perl at the moment due the limited threading functionality they provide and
the global speed hit. I also think that a simple event based I/O framework
might be a bit easier to handle than threads.

Another thing was that I didn't like the APIs of the other modules. In
L<AnyEvent::XMPP> I try to provide low level modules for speaking XMPP as defined
in RFC 3920 and RFC 3921 (see also L<AnyEvent::XMPP::Connection> and
L<AnyEvent::XMPP::IM::Connection>). But I also try to provide a high level API for

 view all matches for this distribution


AnyEvent-XSPromises

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

no_fh_allowed|||
no_op|||
noperl_die|||vn
not_a_number|||
not_incrementable|||
nothreadhook||5.008000|
nuke_stacks|||
num_overflow|||n
oopsAV|||
oopsHV|||
op_append_elem||5.013006|

ppport.h  view on Meta::CPAN


#endif

/* Hint: PL_ppaddr
 * Calling an op via PL_ppaddr requires passing a context argument
 * for threaded builds. Since the context argument is different for
 * 5.005 perls, you can use aTHXR (supplied by ppport.h), which will
 * automatically be defined as the correct argument.
 */

#if (PERL_BCDVERSION <= 0x5005005)

ppport.h  view on Meta::CPAN

#endif

/*
 * Boilerplate macros for initializing and accessing interpreter-local
 * data from C.  All statics in extensions should be reworked to use
 * this, if you want to make the extension thread-safe.  See ext/re/re.xs
 * for an example of the use of these macros.
 *
 * Code that uses these macros is responsible for the following:
 * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
 * 2. Declare a typedef named my_cxt_t that is a structure that contains

ppport.h  view on Meta::CPAN

    defined(PERL_CAPI)    || defined(PERL_IMPLICIT_CONTEXT)

#ifndef START_MY_CXT

/* This must appear in all extensions that define a my_cxt_t structure,
 * right after the definition (i.e. at file scope).  The non-threads
 * case below uses it to declare the data as static. */
#define START_MY_CXT

#if (PERL_BCDVERSION < 0x5004068)
/* Fetches the SV that keeps the per-interpreter data. */

ppport.h  view on Meta::CPAN

#else
    /* older perls don't have PL_numeric_radix_sv so the radix
     * must manually be requested from locale.h
     */
#include <locale.h>
    dTHR;  /* needed for older threaded perls */
    struct lconv *lc = localeconv();
    char *radix = lc->decimal_point;
    if (radix && IN_LOCALE) {
        STRLEN len = strlen(radix);
        if (*sp + len <= send && memEQ(*sp, radix, len)) {

 view all matches for this distribution


AnyEvent-YACurl

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.04  Thu Jan 03 2019
    - allow passing options to new()

0.03  Mon Dec 31 2018
    - explicitly link against c-ares to avoid using threaded cURL resolvers
    - enable CURLOPT_CONNECT_TO

0.02  Sat Dec 29 2018
    - remove a bunch of curl/nghttp2 files we ship, that confused metacpan

 view all matches for this distribution


AnyEvent-ZeroMQ

 view release on metacpan or  search on metacpan

t/basic-tcp.t  view on Meta::CPAN


use AnyEvent::ZeroMQ;
use ZeroMQ::Raw;
use ZeroMQ::Raw::Constants qw(ZMQ_NOBLOCK ZMQ_PUB ZMQ_SUB ZMQ_SUBSCRIBE);

my $c   = ZeroMQ::Raw::Context->new( threads => 10 );
my $pub = ZeroMQ::Raw::Socket->new($c, ZMQ_PUB);
my $sub = ZeroMQ::Raw::Socket->new($c, ZMQ_SUB);
$pub->bind('tcp://127.0.0.1:1234');
$sub->connect('tcp://127.0.0.1:1234');
$sub->setsockopt(ZMQ_SUBSCRIBE, '');

 view all matches for this distribution


AnyMQ-Pg

 view release on metacpan or  search on metacpan

inc/Test/Builder.pm  view on Meta::CPAN

        require Test::Builder::IO::Scalar;
    }
}


# Make Test::Builder thread-safe for ithreads.
BEGIN {
    use Config;
    # Load threads::shared when threads are turned on.
    # 5.8.0's threads are so busted we no longer support them.
    if( $] >= 5.008001 && $Config{useithreads} && $INC{'threads.pm'} ) {
        require threads::shared;

        # Hack around YET ANOTHER threads::shared bug.  It would
        # occasionally forget the contents of the variable when sharing it.
        # So we first copy the data, then share, then put our copy back.
        *share = sub (\[$@%]) {
            my $type = ref $_[0];
            my $data;

inc/Test/Builder.pm  view on Meta::CPAN

            }
            else {
                die( "Unknown type: " . $type );
            }

            $_[0] = &threads::shared::share( $_[0] );

            if( $type eq 'HASH' ) {
                %{ $_[0] } = %$data;
            }
            elsif( $type eq 'ARRAY' ) {

inc/Test/Builder.pm  view on Meta::CPAN

            }

            return $_[0];
        };
    }
    # 5.8.0's threads::shared is busted when threads are off
    # and earlier Perls just don't have that module at all.
    else {
        *share = sub { return $_[0] };
        *lock  = sub { 0 };
    }

inc/Test/Builder.pm  view on Meta::CPAN

            $self->{Expected_Tests} = $self->{Curr_Test};
        }

        # Auto-extended arrays and elements which aren't explicitly
        # filled in with a shared reference will puke under 5.8.0
        # ithreads.  So we have to fill them in by hand. :(
        my $empty_result = &share( {} );
        for my $idx ( 0 .. $self->{Expected_Tests} - 1 ) {
            $test_results->[$idx] = $empty_result
              unless defined $test_results->[$idx];
        }

 view all matches for this distribution


AnyMQ-ZeroMQ

 view release on metacpan or  search on metacpan

lib/AnyMQ/Trait/ZeroMQ.pm  view on Meta::CPAN

}

sub _build__zmq_context {
    my ($self) = @_;

    my $c = ZeroMQ::Raw::Context->new( threads => 10 );
    return $c;
}

sub _build__zmq_sub {
    my ($self) = @_;

 view all matches for this distribution


AnyMongo

 view release on metacpan or  search on metacpan

lib/AnyMongo/BSON/OID.pm  view on Meta::CPAN

    my $id1 = MongoDB::OID->new;
    my $id2 = MongoDB::OID->new(value => $id1->value);

Now C<$id1> and C<$id2> will have the same value.

Warning: at the moment, OID generation is not thread safe.

=head1 DESCRIPTION

=head1 SEE ALSO

 view all matches for this distribution


Apache-ASP

 view release on metacpan or  search on metacpan

ASP.pm  view on Meta::CPAN

=item How can I use $Session to store a $dbh database handle ?

You cannot use $Session to store a $dbh handle.  This can 
be awkward for those coming from the IIS/NT world, where
you could store just about anything in $Session, but this
boils down to a difference between threads vs. processes.

Database handles often have per process file handles open,
which cannot be shared between requests, so though you 
have stored the $dbh data in $Session, all the other 
initializations are not relevant in another httpd process.

ASP.pm  view on Meta::CPAN

even with 1 gig RAM!  To handle more client connections,
look into a dual server, mod_proxy front end.

=head2 High MaxRequestsPerChild

Set your max requests per child thread or process (in httpd.conf) high, 
so that ASP scripts have a better chance being cached, which happens after 
they are first compiled.  You will also avoid the process fork penalty on 
UNIX systems.  Somewhere between 50 - 500 is probably pretty good.
You do not want to set this too high though or you will risk having
your web processes use too much RAM.  One may use Apache::SizeLimit

ASP.pm  view on Meta::CPAN

   CC & BCC headers/recipients.

 + Removed $Apache::ASP::Register definition which defined the current
   executing Apache::ASP object.  Only one part of the application was
   using it, and this has been fixed.  This would have been an unsafe
   use of globals for a threaded environment.

 + Decreased latency when doing Application_OnStart, used to sleep(1) 
   for CleanupMaster sync, but this is not necessary for Application_OnStart 
   scenario

 + Restructure code / core templates for MailErrorsTo funcationality.  
   Wrote test mail_error.t to cover this.  $ENV{REMOTE_USER} will now 
   be displayed in the MailErrorsTo message when defined from 401 basic auth.

 + $Server->RegisterCleanup should be thread safe now, as it no longer relies
   on access to @Apache::ASP::Cleanup for storing the CODE ref stack.

 + test t/inode_names.t for InodeNames and other file tests covering case
   of long file names.

 view all matches for this distribution


Apache-AppCluster

 view release on metacpan or  search on metacpan

Server/t/lib/Apache/test.pm  view on Meta::CPAN

    }
}

$PERL_DIR = $ENV{PERL_DIR} if exists $ENV{PERL_DIR};

$USE_THREAD = ($Config{extensions} =~ /Thread/) || $Config{usethreads};
$USE_SFIO = (($Config{'usesfio'} || '') eq 'true');

my $Is_Win32 = ($^O eq "MSWin32");
sub WIN32 () { $Is_Win32 };

 view all matches for this distribution


( run in 0.752 second using v1.01-cache-2.11-cpan-501a3233654 )