view release on metacpan or search on metacpan
lib/App/Chart/Gtk2/Subprocess.pm view on Meta::CPAN
C<App::Chart::Gtk2::Subprocess> sends a C<App::Chart::Gtk2::Job> task to the subprocess
then reads its output.
C<App::Chart::Gtk2::Subprocess> notices if the child dies because the output pipe
closes. It then waits that child with C<waitpid>.
C<< Glib::Child->watch_add >> is not used because in single thread mode it's
implemented with a non-restart C<sigaction> to stop the main loop poll, and
it's a bit worrying to think how much third-party library code might not
cope gracefully with EINTR.
=head1 FUNCTIONS
view all matches for this distribution
view release on metacpan or search on metacpan
#############################################################
## C,CPP Asynchronous (Threads)
#############################################################
# Run a process/function async (thread)
# Add this to makefile
LIB += -pthread
#
# Add library
#include <pthread.h>
#
# Declare threads
pthread_t threads[1];
#
# Create threads and get return code
# Sending pattern as parameter (only one allowed)
# Thread ID is first parameter
int rc;
rc = pthread_create(&thread, NULL, send_thread, (void *) pattern );
pattern->tid = thread; // Save thread ID so we can later kill it (if needed)
if(rc) return; // Error
#
# Check return value
if(rc) sendlog("ERROR: return code from pthread_create() is %d", rc);
#
# Function is declared like this:
void *send_thread (void * args){
COMMAND_PATTERN* pattern = (COMMAND_PATTERN*) args; // Can use pattern normally
...
}
#
# Make sure to end the function with this:
# (it will exit the thread. don't use in main otherwise will get defunct/zombie process)
pthread_exit(NULL);
# Determine version and library used for threads
# NPTL - Native POSIX Threads Library # Threads share PID
# LinuxThreads # May be different PIDs (plus may other differences)
getconf GNU_LIBPTHREAD_VERSION # NPTL 2.7
#############################################################
## C,CPP - Threads
#############################################################
# Get the current thread's name (like thread ID, tid)
QThread::currentThread()->objectName()
#############################################################
## C,CPP - Timer
blkio cpuacct cpuset freezer memory net_cls,net_prio perf_event rdma unified
cpu cpu,cpuacct devices hugetlb net_cls net_prio pids systemd
# Check if using cgroups v2:
ls /sys/fs/cgroup
cgroup.controllers cgroup.max.descendants cgroup.stat cgroup.threads system.slice
cgroup.max.depth cgroup.procs cgroup.subtree_control init.scope user.slice
#############################################################
## Docker Build
# Print the elements of an array segregated (in parenthesis)
perl -le '@a=qw/this is an array/; local $"=")("; print "(@a)"'
# Split a list into so many parts
# Purpose: Prepare for thread usage.
perl -le '$M=10; $T=3; $from=1; while($to < $M){ $to=$from+(($M-$from+1)/$T--)-1; $to=int($to)+1 if $to != int($to); print "$from -> $to"; $from=$to+1 }'
# Take 3 elements or an array/list at a time
perl -le '@a=0..30; push @b,[splice @a,0,3] while @a; print "@$_" for @b'
1
perl -Mre=is_regexp -E 'say is_regexp 123'
#############################################################
## Perl Modules - threads
#############################################################
# Error: This Perl not built to support threads
# Check if perl binary supports threads.
perl -V:useithreads
perl -MConfig -E 'say $Config{useithreads}'
# Simple thread example in perl
# Threads start running already with threads->create()
perl -Mthreads -le '@t=map threads->create(sub{print "Im #$_"}), 1..10; $_->join for @t'
# Simple thread example in perl
# Find the summation of 1 through 10
# Uses a shared variable between threads
perl -Mthreads -Mthreads::shared -le '$sum=0; share($sum); @t=map threads->create(sub{$sum += $_}), 1..10; print $_->join for @t; print "sum: $sum"'
# Aliases for threads->create.
perl -lMthreads -le '@t=map threads->new(sub{print $_}), 1..3; $_->join for @t'
perl -lMthreads -le '@t=map async(sub{print $_}), 1..3; $_->join for @t'
perl -lMthreads -le '@t=map threads->new(sub{print $_}), 1..3; $_->join for @t'
# If using a coderef, you must use threads->create.
perl -lMthreads -le '$sub = sub{ print "123" }; @t=map threads->new( $sub ), 1..3; $_->join for @t'
# If using a coderef, you must use threads->create (with arguments).
perl -lMthreads -le '$sub = sub{ print "@_" }; @t=map threads->new( $sub, $_ ), 1..3; $_->join for @t'
# Shared and non shared variables example
perl -lMthreads -Mthreads::shared -le '$a=$b=1; share($a); async(sub{$a++; $b++})->join; print "a=$a, b=$b"'
# Thread pitfall. $a can be either 2 or 3 (race condition)
perl -lMthreads -Mthreads::shared -le '$a=1; share($a); $_->join for map async(sub{my $foo=$a; $a=$foo+1}), 1..2; print "a=$a"'
# Allow only one thread to touch a variable at a time
# This will cause a "deadlock" where one thread requires a reourses
# locked by another thread and vice versa
perl -Mthreads -Mthreads::shared -le 'share $a; share $b; push @t, async(sub{lock $a; sleep 20; lock $b}); push @t, async(sub{lock $b; sleep 20; lock $a}); $_->join for @t'
#
# Alternate syntax 1
perl -Mthreads -le 'my $a :shared; my $b :shared; push @t, async(sub{lock $a; sleep 20; lock $b}); push @t, async(sub{lock $b; sleep 20; lock $a}); $_->join for @t'
#
# Alternate syntax 2
perl -Mthreads -le 'my $a :shared; my $b :shared; push @t, threads->create(sub{lock $a; sleep 20; lock $b}); push @t, threads->create(sub{lock $b; sleep 20; lock $a}); $_->join for @t'
# Thread safe queues. Passing data around
perl -Mthreads -MThread::Queue -le 'my $q=Thread::Queue->new; $t=async(sub{ print "Popped $d off the queue" while $d=$q->dequeue }); $q->enqueue(12); $q->enqueue(qw/A B C/); sleep 1; $q->enqueue(undef); $t->join'
# Thread safe queues. Passing complex data around
perl -Mthreads -MThread::Queue -le 'my $q=Thread::Queue->new; $t=async(sub{ print "Popped @$d off the queue" while $d=$q->dequeue }); $q->enqueue([1..3]); $q->enqueue([qw/A B C/]); sleep 1; $q->enqueue(undef); $t->join'
# Compute pi using parallel threading
time perl -Mthreads -Mthreads::shared -le 'share $sum; $M=100_000_000; $T=6; $h=1/$M; sub sum { my $s; my($from,$to)=@_; for($from..$to){ my $x=$h*($_-0.5); $s += 4/(1+$x**2)}; $s } sub split_by { my($max,$by)=@_; my $from=1; my @l; while($to<$max){ ...
#############################################################
## Perl Modules - CAM::PDF
#############################################################
## Perl Modules - Parallel::ForkManager
#############################################################
# Simple exmplae of parallel processing
# (Perl Modules - Parallel::ForkManager)
# About 3 times slower than using threads!!!
perl -MParallel::ForkManager -E '
my $pm = Parallel::ForkManager->new(30);
for my $file (1..30) {
$pm->start and next;
say "Processing file $file";
# Using the shebang line with perlbrew (-S to pass in args)
#!/usr/bin/env perl
#!/usr/bin/env -S perl -l
# Install with thread support.
perlbrew install perl-5.38.2 --thread
# Install multiple versions with and without thread support.
perlbrew install-multiple 5.38.2 blead --both thread
perlbrew switch perl-5.38.2-thread-multi
perl -V:'use.*thread.*'
# Upgrade current perl version.
perlbrew upgrade-perl
# Upgrade perlbrew
#############################################################
# Install sqlite on Unix (after in zipping the amalgamation file. make sure these 3 are present:
# shell.c, sqlite3.c, sqlite3.h). rename to a.out to sqlite3
# (database, sqlite3)
gcc shell.c sqlite3.c -lpthread -ldl
# View all the tables in a database (database, sqlite3)
sqlite3 my.db '.tables'
# Turn on column names on query results (database, sqlite3)
#############################################################
## WII
#############################################################
# Write files/games to WII.
https://mariokartwii.com/showthread.php?tid=121
https://www.gametdb.com/Wii/Search
#############################################################
## Windows Bugs
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Context/NetServer.pm view on Meta::CPAN
#############################################################################
=head1 DESCRIPTION
A Context class models the environment (aka "context)
in which the current execution thread is running.
For the App::Context::NetServer class, this is the runtime environment
of a server with any of the following Net::Server personalities.
* Net::Server - generic, single-connection server
* Net::Server::INET - a server controlled by inetd
view all matches for this distribution
view release on metacpan or search on metacpan
bin/cronjob view on Meta::CPAN
#pod the time taken to run, the exit status, any signal received, and whether core
#pod was dumped. It will also include the full (combined) output of the process.
#pod
#pod The report will be send from C<--sender> (or a reasonable default) to C<--rcpt>
#pod (or C<root>). Its C<In-Reply-To> header will be set to a hashed value that
#pod will cause all same-subject jobs to thread together in threaded mail readers.
#pod The C<--subject> switch sets the message subject, so it's responsible for
#pod deciding which jobs thread together. For jobs that run with variable
#pod arguments, providing a C<--subject> argument is a very good idea.
#pod
#pod =head2 locking
#pod
#pod The default lockfile name is generated with code something like this:
bin/cronjob view on Meta::CPAN
the time taken to run, the exit status, any signal received, and whether core
was dumped. It will also include the full (combined) output of the process.
The report will be send from C<--sender> (or a reasonable default) to C<--rcpt>
(or C<root>). Its C<In-Reply-To> header will be set to a hashed value that
will cause all same-subject jobs to thread together in threaded mail readers.
The C<--subject> switch sets the message subject, so it's responsible for
deciding which jobs thread together. For jobs that run with variable
arguments, providing a C<--subject> argument is a very good idea.
=head2 locking
The default lockfile name is generated with code something like this:
view all matches for this distribution
view release on metacpan or search on metacpan
Reference Source: MISC
- Name: https://phabricator.wikimedia.org/T280226
- URL: https://phabricator.wikimedia.org/T280226
Reference Source: CONFIRM
- Name: https://lists.wikimedia.org/hyperkitty/list/mediawiki-announce@lists.wikimedia.org/thread/YR3X4L2CPSEJVSY543AWEO65TD6APXHP/
- URL: https://lists.wikimedia.org/hyperkitty/list/mediawiki-announce@lists.wikimedia.org/thread/YR3X4L2CPSEJVSY543AWEO65TD6APXHP/
Reference Source: GENTOO
- Name: GLSA-202107-40
- URL: https://security.gentoo.org/glsa/202107-40
```
view all matches for this distribution
view release on metacpan or search on metacpan
MANIFEST.SKIP view on Meta::CPAN
#!start included /home/mjgardner/perl5/perlbrew/perls/perl-5.20.1-usethreads/lib/site_perl/5.20.1/ExtUtils/MANIFEST.SKIP
# Avoid version control files.
\bRCS\b
\bCVS\b
\bSCCS\b
,v$
MANIFEST.SKIP view on Meta::CPAN
# Avoid prove files
\B\.prove$
# Avoid MYMETA files
^MYMETA\.
#!end included /home/mjgardner/perl5/perlbrew/perls/perl-5.20.1-usethreads/lib/site_perl/5.20.1/ExtUtils/MANIFEST.SKIP
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dapper/Serve.pm view on Meta::CPAN
package App::Dapper::Serve;
=head1 NAME
App::Dapper::Serve - Simple threaded webserver that serves static files
=cut
use utf8;
use open ':std', ':encoding(UTF-8)';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dazz/Command/contained.pm view on Meta::CPAN
[ "len|l=i", "minimal length of overlaps", { default => 500 }, ],
[ "idt|i=f", "minimal identity of overlaps", { default => 0.98 }, ],
[ "proportion=f", "nearly contained proportion", { default => 0.98 }, ],
[ "prefix=s", "prefix of names", { default => "infile" }, ],
[ "tmp=s", "user defined tempdir", ],
[ "parallel|p=i", "number of threads", { default => 8 }, ],
[ "verbose|v", "verbose mode", ],
{ show_defaults => 1, }
);
}
view all matches for this distribution
view release on metacpan or search on metacpan
bin/pmat-explore-gtk view on Meta::CPAN
$pmat = Devel::MAT->load( $filename, progress => \&progress );
$df = $pmat->dumpfile;
$perlver_label->set_text( join " ", "Perl",
$df->perlversion,
( $df->ithreads ? "thread" : () ),
( $df->ptr_len * 8 ) . "bit",
);
$svcount_label->set_text( scalar($df->heap) . " SVs" );
# We're going to be using Inrefs
view all matches for this distribution
view release on metacpan or search on metacpan
scripts/dex view on Meta::CPAN
Often uses intermediate files (determined by File::Temp, and thus by the
File::Spec defaults and the TMPDIR env. variable) for speed, portability and
simplicity.
Use extreme caution when using C<run3> in a threaded environment if concurrent
calls of C<run3> are possible. Most likely, I/O from different invocations will
get mixed up. The reason is that in most thread implementations all threads in
a process share the same STDIN/STDOUT/STDERR. Known failures are Perl ithreads
on Linux and Win32. Note that C<fork> on Win32 is emulated via Win32 threads
and hence I/O mix up is possible between forked children here (C<run3> is "fork
safe" on Unix, though).
=head1 DEBUGGING
scripts/dex view on Meta::CPAN
=back
=cut
YAML_PP_WRITER_FILE
$fatpacked{"x86_64-linux-gnu-thread-multi/List/Util.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'X86_64-LINUX-GNU-THREAD-MULTI_LIST_UTIL';
# Copyright (c) 1997-2009 Graham Barr <gbarr@pobox.com>. All rights reserved.
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
# Maintained since 2013 by Paul Evans <leonerd@leonerd.org.uk>
scripts/dex view on Meta::CPAN
=cut
1;
X86_64-LINUX-GNU-THREAD-MULTI_LIST_UTIL
$fatpacked{"x86_64-linux-gnu-thread-multi/List/Util/XS.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'X86_64-LINUX-GNU-THREAD-MULTI_LIST_UTIL_XS';
package List::Util::XS;
use strict;
use warnings;
use List::Util;
scripts/dex view on Meta::CPAN
modify it under the same terms as Perl itself.
=cut
X86_64-LINUX-GNU-THREAD-MULTI_LIST_UTIL_XS
$fatpacked{"x86_64-linux-gnu-thread-multi/Scalar/Util.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'X86_64-LINUX-GNU-THREAD-MULTI_SCALAR_UTIL';
# Copyright (c) 1997-2007 Graham Barr <gbarr@pobox.com>. All rights reserved.
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
# Maintained since 2013 by Paul Evans <leonerd@leonerd.org.uk>
scripts/dex view on Meta::CPAN
it under the same terms as Perl itself.
=cut
X86_64-LINUX-GNU-THREAD-MULTI_SCALAR_UTIL
$fatpacked{"x86_64-linux-gnu-thread-multi/Sub/Util.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'X86_64-LINUX-GNU-THREAD-MULTI_SUB_UTIL';
# Copyright (c) 2014 Paul Evans <leonerd@leonerd.org.uk>. All rights reserved.
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
package Sub::Util;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Difio/OpenShift.pm view on Meta::CPAN
};
my $pod_parsed = "";
my $parser = App::Difio::OpenShift::Parser->new();
$parser->output_string( \$pod_parsed );
$parser->parse_file("$ENV{'OPENSHIFT_GEAR_DIR'}/perl5lib/lib/perl5/x86_64-linux-thread-multi/perllocal.pod");
my @installed;
foreach my $nv (split(/\n/, $pod_parsed)) {
my @name_ver = split(/ /, $nv);
push(@installed, {'n' => $name_ver[0], 'v' => $name_ver[1]});
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/DocKnot/Command.pm view on Meta::CPAN
options => [
'modified|m', 'style|s=s', 'title|t=s', 'use-value|u',
],
maximum => 2,
},
'spin-thread' => {
method => 'spin_thread_file',
module => 'App::DocKnot::Spin::Thread',
options => ['style-url|s=s'],
maximum => 2,
},
update => {
view all matches for this distribution
view release on metacpan or search on metacpan
t/data/fc-solve-git-du-output.txt view on Meta::CPAN
12 ./fc-solve/docs/2_freecells-Report-for-first-400K-deals
120 ./fc-solve/docs
1520 ./fc-solve/presets/variations-on-depth-test-order/freecell-4/data
1528 ./fc-solve/presets/variations-on-depth-test-order/freecell-4
1532 ./fc-solve/presets/variations-on-depth-test-order
8 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/DEMOS-programs/data
24 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/DEMOS-programs
12 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/docs
8336 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/2-cells-freecell/data
8368 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/2-cells-freecell
32 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/t
11068 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/data
36 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/optimize-seq/Find-Optimized-Sequence/Find-Optimized-Sequence
48 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/optimize-seq/Find-Optimized-Sequence
12 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/optimize-seq/results
8 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/optimize-seq/perl
12 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/optimize-seq/t
12 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/optimize-seq/scripts
104 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/optimize-seq
8 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/FC_Solve
8 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/scripts
8 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/rejects
12 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/bakers_dozen/data
44 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/bakers_dozen
9980 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/with-sp-run-to-founds/data
4944 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/with-sp-run-to-founds/wallclock-timings
14968 ./fc-solve/presets/soft-threads/meta-moves/auto-gen/with-sp-run-to-founds
34764 ./fc-solve/presets/soft-threads/meta-moves/auto-gen
34800 ./fc-solve/presets/soft-threads/meta-moves
7484 ./fc-solve/presets/soft-threads/atomic-moves/auto-gen/data
7548 ./fc-solve/presets/soft-threads/atomic-moves/auto-gen
7560 ./fc-solve/presets/soft-threads/atomic-moves
42364 ./fc-solve/presets/soft-threads
308 ./fc-solve/presets/flares-based-scans-data
44208 ./fc-solve/presets
8 ./fc-solve/scripts/old
12 ./fc-solve/scripts/range-solving-of-deals
28 ./fc-solve/scripts/parallel-solve-and-verify-for-bakers-game
view all matches for this distribution
view release on metacpan or search on metacpan
config/to_blead/Switch/.dualLivedDiffConfig
config/to_blead/Sys-Syslog/.dualLivedDiffConfig
config/to_blead/Test-Harness/.dualLivedDiffConfig
config/to_blead/Test/.dualLivedDiffConfig
config/to_blead/Text-Soundex/.dualLivedDiffConfig
config/to_blead/threads-shared/.dualLivedDiffConfig
config/to_blead/threads/.dualLivedDiffConfig
config/to_blead/Time-HiRes/.dualLivedDiffConfig
config/to_blead/Time-Piece/.dualLivedDiffConfig
config/to_blead/XSLoader/.dualLivedDiffConfig
example/.dualLivedDiffConfig
example/README
view all matches for this distribution
view release on metacpan or search on metacpan
bin/dual-lived view on Meta::CPAN
'experimental',
'fields',
'if',
'lib',
'parent',
'threads',
'threads::shared',
'version',
'vmsish'
);
my @authors = qw(
view all matches for this distribution
view release on metacpan or search on metacpan
docs/Gemfile.lock view on Meta::CPAN
faraday (> 0.8, < 2.0)
simpleidn (0.2.1)
unf (~> 0.1.4)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (1.2.9)
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.8)
unicode-display_width (1.8.0)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Egaz/Command/blastlink.pm view on Meta::CPAN
sub opt_spec {
return (
[ "outfile|o=s", "Output filename. [stdout] for screen", { default => "stdout" }, ],
[ "coverage|c=f", "coverage of identical matches", { default => 0.9 }, ],
[ "batch=i", "batch size of blast records", { default => 500000 }, ],
[ "parallel|p=i", "number of threads", { default => 2 }, ],
[ "verbose|v", "verbose mode", ],
{ show_defaults => 1, }
);
}
view all matches for this distribution
view release on metacpan or search on metacpan
scripts/es-status.pl view on Meta::CPAN
output({kv=>1}, "open_fd", $node->{process}{open_file_descriptors} );
# JVM Stats
output({kv=>1}, "jvm", '');
# Threads
output({indent=>1,kv=>1}, "threads_current", $node->{jvm}{threads}{count});
output({indent=>1,kv=>1}, "threads_peak", $node->{jvm}{threads}{peak_count});
# Memory
output({indent=>1,kv=>1}, "mem", '');
output({indent=>2,kv=>1,color=>"yellow"}, "heap_used", $node->{jvm}{mem}{heap_used});
verbose({indent=>2,kv=>1,color=>"yellow"}, "heap_used_bytes", $node->{jvm}{mem}{heap_used_in_bytes});
output({indent=>2,kv=>1}, "heap_committed", $node->{jvm}{mem}{heap_committed});
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/EvalServerAdvanced/Seccomp.pm view on Meta::CPAN
This does not provide absolute security. It relies on the fact that the syscalls allowed
are likely to be safe, or commonly required for normal programs to function properly.
In particular there are two syscalls that are allowed that are involved in the Dirty COW
kernel exploit. C<madvise> and C<mmap>, with these two you can actually trigger the Dirty COW
exploit. But because the default rules restrict you from creating threads, you can't create the race
condition needed to actually accomplish it. So you should still take some
other measures to protect yourself.
=head1 KNOWN ISSUES
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/EventStreamr/DVswitch/Youtube.pm view on Meta::CPAN
return 'ffmpeg';
}
}
method _build_cmd() {
my $command = 'dvsink-command -h $host -p $port -- '.$self->avlib.' -i - -deinterlace -vcodec libx264 -pix_fmt yuv420p -vf scale=-1:480 -preset $preset -r $fps -g $gop -b:v $bitrate -acodec libmp3lame -ar 44100 -threads 6 -qscale 3 -b:a 256000 -buf...
my $gop = ($self->{config}{youtube}{fps} * 2);
my %cmd_vars = (
host => $self->{config}{mixer}{host},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Exifpic.pm view on Meta::CPAN
package App::Exifpic;
use 5.010;
use strict;
use warnings;
use threads;
use Thread::Queue;
use autodie;
use Image::ExifTool;
use Imager;
use File::Slurp qw(read_file);
lib/App/Exifpic.pm view on Meta::CPAN
# Run our application...
sub run {
my ($self) = shift;
# Imager needs to be preloaded if we're using threads.
Imager->preload;
# Right now we treat everything as a file to process...
my $work_queue = Thread::Queue->new;
$work_queue->enqueue(@_);
$work_queue->end;
# Spawn our threads, each of which will process files until we're done.
my @threads;
my $cores = $self->get_cores();
# TODO: This could look less ugly
for (1..$cores) {
push(@threads,
threads->create( sub {
while (my $src = $work_queue->dequeue) {
$self->process_image($src);
}
})
);
}
# Join threads.
foreach my $thread (@threads) { $thread->join; }
return EXIT_SUCCESS;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/FQStat/Scanner.pm view on Meta::CPAN
warnenter if ::DEBUG;
my $forced = shift;
lock($::ScannerStartRun);
if (not defined $::ScannerThread) {
warnline "Creating new (initial?) scanner thread" if ::DEBUG;
$::ScannerThread = threads->new(\&App::FQStat::Scanner::scanner_thread);
}
elsif ($::ScannerThread->is_joinable()) {
warnline "Joining scanner thread" if ::DEBUG;
my $return = $::ScannerThread->join();
($::Records, $::NoActiveNodes) = @$return;
$::Summary = [];
$::Initialized = 1;
{ lock($::RecordsChanged); $::RecordsChanged = 1; }
warnline "Joined scanner thread. Creating new scanner thread" if ::DEBUG;
$::ScannerThread = threads->new(\&App::FQStat::Scanner::scanner_thread);
}
elsif (!$::ScannerThread->is_running()) {
warnline "scanner thread not running. Creating new scanner thread" if ::DEBUG;
undef $::ScannerThread;
$::ScannerThread = threads->new(\&App::FQStat::Scanner::scanner_thread);
}
elsif ($forced) {
warnline "scanner thread running. Force in effect, setting StartRun" if ::DEBUG;
$::ScannerStartRun = 1;
}
}
sub scanner_thread {
warnenter if ::DEBUG;
{
lock($::ScannerStartRun);
$::ScannerStartRun = 0;
}
lib/App/FQStat/Scanner.pm view on Meta::CPAN
if ($::DisplayOffset and $::DisplayOffset > $limit) {
$::DisplayOffset = $limit;
}
sleep 0.1; # Note to self: fractional sleep without HiRes => CPU=100%
warnline "End of scanner_thread" if ::DEBUG;
return [\@lines, $noActiveNodes];
}
view all matches for this distribution
view release on metacpan or search on metacpan
bin/fetchware view on Meta::CPAN
30 2 * * * fetchware upgrade-all
=head1 MOTIVATION
While sysadmining I liked to install my own compiled from source versions of
popular programs like Apache, MySQL, or Perl without threading. However, doing
so means that you have to manually recompile everytime a new security hole comes
out, which is annoyingly frequent for Apache. So, fetchware was created to bring
the power of package management to source code distributions.
=head1 DESCRIPTION
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Test/NoMore.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
view release on metacpan or search on metacpan
1.000003 2017-05-18
- Removed the use List::Gather. This seems to be the most likely culprit for
some very odd test failures seen with threaded versions of Perl. See
https://rt.cpan.org/Ticket/Display.html?id=121777 for details.
1.000002 2017-05-04
view all matches for this distribution
view release on metacpan or search on metacpan
* print --help message as table (`rsync --help' like, at least in options
section)
* add priority-based option lookup
* add environment variables handling (those options will also get their prio)
* set/change options later, at run time, using copy-on-write strategy
(multithreading anyone?)
List of ideas to settle
* how about whole subtree aliases? (for subsystem to have its own view on
config options without arduous copying all the options)
view all matches for this distribution
view release on metacpan or search on metacpan
bin/gitc-submit view on Meta::CPAN
TMPDIR => 1,
CLEANUP => 1,
);
my $project = project_name();
git "format-patch -o $tmpdir"
. " --thread"
. " --no-numbered"
. " --cover-letter"
. " --no-color"
. " --no-binary"
. " -M -C --no-ext-diff"
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Glacier/Command/Get.pm view on Meta::CPAN
package App::Glacier::Command::Get;
use strict;
use warnings;
use threads;
use threads::shared;
use App::Glacier::Core;
use App::Glacier::Job::FileRetrieval;
use App::Glacier::DateTime;
use App::Glacier::Progress;
use parent qw(App::Glacier::Command);
lib/App/Glacier/Command/Get.pm view on Meta::CPAN
my @part_hashes :shared = ();
my $p = new App::Glacier::Progress($total_parts,
prefix => $localname)
unless $self->{_options}{quiet};
for (my $i = 0; $i < $njobs; $i++) {
my ($thr) = threads->create(
sub {
my ($job_idx) = @_;
# Number of part to start from
my $part_idx = $job_idx * $job_parts;
# Offset in file
lib/App/Glacier/Command/Get.pm view on Meta::CPAN
return 1;
}, $i);
}
$self->debug(2, "waiting for download to finish");
foreach my $thr (threads->list()) {
# FIXME: error handling
$thr->join() or croak "thread $thr failed";
}
$p->finish('downloaded') if $p;
close($fd);
return $glacier->_tree_hash_from_array_ref(\@part_hashes);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/GoogleSearchPerlmonksUser.pm view on Meta::CPAN
v => 1.1,
summary => 'Search Google for user mentions in perlmonks.org',
description => <<'_',
Basically a shortcut for launching Google search for a user (specifically, user
mentions in discussion threads) in `perlmonks.org` site, with some unwanted
pages excluded.
_
args => {
user => {
lib/App/GoogleSearchPerlmonksUser.pm view on Meta::CPAN
google_search_perlmonks_user(%args) -> [status, msg, result, meta]
Search Google for user mentions in perlmonks.org.
Basically a shortcut for launching Google search for a user (specifically, user
mentions in discussion threads) in C<perlmonks.org> site, with some unwanted
pages excluded.
This function is not exported.
Arguments ('*' denotes required arguments):
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/HTTP_Proxy_IMP.pm view on Meta::CPAN
App::HTTP_Proxy_IMP implements an HTTP proxy, which can inspect and modify the
HTTP header or content before forwarding. Inspection and modification is done
with plugins implementing the L<Net::IMP> interface.
The proxy is single-threaded and non-forking, but due to the event-driven model
it can still process multiple connections in parallel. It is mainly intended to
be used as a platform for easy prototyping of interesting ideas using IMP
plugins, but should be also fast enough to be used to enhance, secure, restrict
or protocol the browsing experience for small groups.
view all matches for this distribution