| /openbsd-src/gnu/usr.bin/perl/dist/threads/t/ |
| H A D | state.t | 14 use threads; 17 if (! eval 'use threads::shared; 1') { 18 print("1..0 # SKIP threads::shared not available\n"); 101 threads->yield(); 106 my $thr = threads->create('do_thread'); 109 ok(threads->list(threads::running) == 1, 'thread running list'); 112 ok(threads->list(threads::joinable) == 0, 'thread joinable list'); 113 ok(threads->list(threads::all) == 1, 'thread list'); 117 ok(threads->list(threads::running) == 0, 'thread running list'); 120 ok(threads->list(threads::joinable) == 1, 'thread joinable list'); [all …]
|
| H A D | basic.t | 33 use threads; 35 if ($threads::VERSION && ! $ENV{'PERL_CORE'}) { 36 print(STDERR "# Testing threads $threads::VERSION\n"); 43 ok(2, 1 == $threads::threads, "Check that threads::threads is true"); 48 threads->create('test1', 'bar')->join(); 53 threads->create(\&test2, [{'foo' => 'bar'}])->join(); 58 threads->create(\&test3, 1)->join(); 65 my $thread1 = threads->create('test4'); 68 threads->yield(); 76 threads->create('test6')->join(); [all …]
|
| H A D | list.t | 33 use threads; 38 ok(2, scalar @{[threads->list()]} == 0, 'No threads yet'); 40 threads->create(sub {})->join(); 41 ok(3, scalar @{[threads->list()]} == 0, 'Empty thread list after join'); 43 my $thread = threads->create(sub {}); 44 ok(4, scalar(threads->list()) == 1, 'Non-empty thread list'); 45 ok(5, threads->list() == 1, 'Non-empty thread list'); 47 ok(6, scalar @{[threads->list()]} == 0, 'Thread list empty again'); 48 ok(7, threads->list() == 0, 'Thread list empty again'); 50 $thread = threads->create(sub { [all …]
|
| H A D | exit.t | 17 use threads; 20 if (! eval 'use threads::shared; 1') { 21 skip_all('threads::shared not available'); 42 my $thr = threads->create(sub { 43 threads->exit(); 46 ok($thr, 'Created: threads->exit()'); 48 ok(! defined($rc), 'Exited: threads->exit()'); 51 run_perl(prog => 'use threads 2.21;' . 52 'threads->exit(86);' . 61 $thr = threads->create({'exit' => 'thread_only'}, sub { [all …]
|
| H A D | free2.t | 19 use threads; 22 if (! eval 'use threads::shared; 1') { 23 Test::skip_all(q/threads::shared not available/); 26 if (($] < 5.008002) && ($threads::shared::VERSION < 0.92)) { 27 Test::skip_all(q/Needs threads::shared 0.92 or later/); 76 my $tid = threads->tid(); 79 threads->yield(); 88 my $th = threads->create($next, $q); 101 threads->yield(); 108 my $tid = threads->tid(); [all …]
|
| H A D | blocks.t | 14 use threads; 17 if (! eval 'use threads::shared; 1') { 18 print("1..0 # SKIP threads::shared not available\n"); 69 threads->create('foo')->join(); 71 threads->create(\&foo)->join(); 73 threads->create(sub { lock($COUNT); $COUNT++; })->join(); 76 threads->create('foo')->detach(); 78 threads->create(\&foo)->detach(); 80 threads->create(sub { lock($COUNT); $COUNT++; })->detach(); 82 $bthr = threads->create('baz'); [all …]
|
| H A D | free.t | 19 use threads; 22 if (! eval 'use threads::shared; 1') { 23 Test::skip_all(q/threads::shared not available/); 67 my $tid = threads->tid(); 78 threads->create('threading_1', $q)->detach(); 102 threads->create('threading_1', $q)->detach(); 111 threads->create(sub { 112 threads->create(sub { })->join(); 118 ok($COUNT == 5, "Done - $COUNT threads"); 124 my $tid = threads->tid(); [all …]
|
| H A D | thread.t | 16 use threads; 19 if (! eval 'use threads::shared; 1') { 20 skip_all('threads::shared not available'); 36 my $t = threads->create(\&content, "ok 2\n", "ok 3\n", 1..1000); 44 $t = threads->create(sub { lock($lock); print "ok 5\n"}); 55 $ret = threads->create(\&dorecurse, @_); 60 my $t = threads->create(\&dorecurse, map { "ok $_\n" } 6..10); 66 my $t = threads->create(\&dorecurse, "ok 11\n"); 67 threads->yield; # help out non-preemptive thread implementations 80 $ret = threads->create(\&islocked, shift); [all …]
|
| H A D | stack.t | 59 use threads ('stack_size' => $size); 64 my $actual_size = threads->get_stack_size(); 77 is(3, threads->set_stack_size($size_plus_quarter), $size, 79 is(4, threads->get_stack_size(), $size_plus_quarter, 82 threads->create( 84 is(5, threads->get_stack_size(), $size_plus_quarter, 86 is(6, threads->self()->get_stack_size(), $size_plus_quarter, 88 is(7, threads->set_stack_size($size), $size_plus_quarter, 90 is(8, threads->get_stack_size(), $size, 92 is(9, threads->self()->get_stack_size(), $size_plus_quarter, [all …]
|
| H A D | kill2.t | 15 use threads; 18 if (! eval 'use threads::shared; 1') { 19 skip_all('threads::shared not available'); 23 my $thr = threads->create(sub {}); 34 use threads; 42 my $thr = threads->create($test, $sema); 52 use threads; 57 $SIG{'TERM'} = sub { threads->exit() }; 61 my $thr = threads->create($test, $sema); 71 use threads; [all …]
|
| H A D | join.t | 14 use threads; 17 if (! eval 'use threads::shared; 1') { 18 print("1..0 # SKIP threads::shared not available\n"); 59 my $retval = threads->create(sub { return ("hi") })->join(); 63 my ($thread) = threads->create(sub { return (1,2,3) }); 68 my $retval = threads->create(sub { return [1] })->join(); 72 my $retval = threads->create(sub { return { foo => "bar" }})->join(); 76 my $retval = threads->create( sub { 88 my $retval = threads->create(sub { return $_[0]}, \$test)->join(); 94 my $retval = threads->create(sub { return $_[0]}, \$test)->join(); [all …]
|
| H A D | context.t | 14 use threads; 17 if (! eval 'use threads::shared; 1') { 18 print("1..0 # SKIP threads::shared not available\n"); 71 my ($thr) = threads->create('foo', 'array'); 75 $thr = threads->create('foo', 'scalar'); 79 threads->create('foo', 'void'); 80 ($thr) = threads->list(); 84 $thr = threads->create({'context' => 'array'}, 'foo', 'array'); 88 ($thr) = threads->create({'scalar' => 'scalar'}, 'foo', 'scalar'); 92 $thr = threads->create({'void' => 1}, 'foo', 'void'); [all …]
|
| H A D | version.t | 13 use threads; 15 # test that the version documented in threads.pm pod matches 18 open my $fh, "<", $INC{"threads.pm"} 19 or die qq(Failed to open '$INC{"threads.pm"}': $!); 23 if ($file=~/This document describes threads version (\d.\d+)/) { 26 is($pod_version, $threads::VERSION, 27 "Check that pod and \$threads::VERSION match");
|
| /openbsd-src/regress/lib/libpthread/stdfiles/ |
| H A D | Makefile | 9 CLEANFILES+= ${PROG2} threads no-threads 15 threads: ${PROG} target 16 ./${PROG} > threads 25 no-threads: ${PROG2} 26 ./${PROG2} > no-threads 30 diff: threads no-threads 31 diff -u threads no-threads 33 .PHONY: threads no-threads diff
|
| /openbsd-src/gnu/usr.bin/perl/dist/Thread-Queue/t/ |
| H A D | 09_ended.t | 17 use threads; 27 # Test for end() while threads are blocked and no more items in queue 33 my @threads; 35 push @threads, threads->create( sub { 50 # Make sure there's nothing in the queue and threads are blocking 55 threads->yield(); 64 for my $thread (@threads) { 70 # Test for end() while threads are blocked and items still remain in queue 76 my @threads; 78 push @threads, threads->create( sub { [all …]
|
| H A D | 01_basic.t | 12 use threads; 25 ### Basic usage with multiple threads ### 34 my $id = threads->tid(); 42 my @threads; 43 push(@threads, threads->create('reader')) for (1..$nthreads); 52 $_->join() foreach @threads; 53 undef(@threads); 67 threads->create(sub { 86 my $id = threads->tid(); 95 push(@threads, threads->create('reader2')) for (1..$nthreads); [all …]
|
| /openbsd-src/gnu/usr.bin/perl/pod/ |
| H A D | perlthrtut.pod | 5 perlthrtut - Tutorial on threads in Perl 9 This tutorial describes the use of Perl interpreter threads (sometimes 12 between threads must be explicit. The user-level interface for I<ithreads> 13 uses the L<threads> class. 16 that used the L<threads> class. This old model was known to have problems, is 18 strongly encouraged to migrate any existing 5.005 threads code to the new 24 have C<use5005threads=define> you have 5.005 threads. 28 The L<threads> and L<threads::shared> modules are included in the core Perl 40 thread. With 5.8, though, you can create extra threads [all...] |
| /openbsd-src/gnu/usr.bin/perl/dist/threads-shared/t/ |
| H A D | clone.t | 35 use threads; 36 use threads::shared; 56 threads->create(sub {})->join(); # Hide leaks, etc. 67 threads->create(sub { 78 ok($test++, threads::shared::_id($foo) == threads::shared::_id($$foo), 'Circular ref'); 80 threads->create(sub { 81 … ok($test++, threads::shared::_id($foo) == threads::shared::_id($$foo), 'Circular ref in thread'); 90 ok($test++, threads::shared::_id($$foo) == threads::shared::_id($$$$$foo), 103 threads->create(sub { 133 threads->create(sub { [all …]
|
| H A D | cond.t | 35 use threads; 36 use threads::shared; 56 threads->yield; 73 threads->yield; 85 threads->yield; 88 threads->yield; 96 threads->yield; 99 threads->yield; 101 threads->yield; 149 my $tr2 = threads->create(\&bar); [all …]
|
| H A D | av_refs.t | 33 use threads; 34 use threads::shared; 52 my $av = threads->create(sub { 65 threads->create(sub { $av[0] = "hihi" })->join(); 70 threads->create(sub { @$av = () })->join(); 71 threads->create(sub { ok(9, scalar @$av == 0, 'Array cleared in thread'); })->join(); 73 threads->create(sub { 74 unshift(@$av, threads->create(sub { 83 threads->create(sub { push @{$av->[0]}, \@av })->join(); 84 threads->create(sub { $av[0] = 'testtest'})->join(); [all …]
|
| /openbsd-src/gnu/llvm/compiler-rt/lib/tsan/tests/unit/ |
| H A D | tsan_trace_test.cpp | 37 for (auto *&thr : threads) { in ThreadArray() 49 if (threads[i]) in ~ThreadArray() 55 auto *thr = threads[i]; in Finish() 56 threads[i] = nullptr; in Finish() 64 ThreadState *threads[N]; member 65 ThreadState *operator[](uptr i) { return threads[i]; } in operator []() 66 ThreadState *operator->() { return threads[0]; } in operator ->() 67 operator ThreadState *() { return threads[0]; } in operator ThreadState*() 278 ThreadArray<2> threads; in TRACE_TEST() local 279 check_thread(threads[0], 0, 0, 0, 0, 0); in TRACE_TEST() [all …]
|
| /openbsd-src/gnu/usr.bin/perl/dist/Thread-Semaphore/t/ |
| H A D | 01_basic.t | 12 use threads; 13 use threads::shared; 24 ### Basic usage with multiple threads ### 33 my @threads; 35 push @threads, threads->create(sub { 45 push @threads, threads->create(sub { 70 $_->join for @threads;
|
| H A D | 06_timed.t | 12 use threads; 13 use threads::shared; 24 ### Basic usage with multiple threads ### 33 my @threads; 35 push @threads, threads->create(sub { 45 push @threads, threads->create(sub { 70 $_->join for @threads;
|
| /openbsd-src/gnu/llvm/compiler-rt/lib/sanitizer_common/tests/ |
| H A D | sanitizer_mutex_test.cpp | 131 pthread_t threads[kThreads]; in TEST() local 133 PTHREAD_CREATE(&threads[i], 0, lock_thread<SpinMutex>, &data); in TEST() 135 PTHREAD_JOIN(threads[i], 0); in TEST() 142 pthread_t threads[kThreads]; in TEST() local 144 PTHREAD_CREATE(&threads[i], 0, try_thread<SpinMutex>, &data); in TEST() 146 PTHREAD_JOIN(threads[i], 0); in TEST() 152 pthread_t threads[kThreads]; in TEST() local 154 PTHREAD_CREATE(&threads[i], 0, read_write_thread<Mutex>, &data); in TEST() 155 for (int i = 0; i < kThreads; i++) PTHREAD_JOIN(threads[i], 0); in TEST() 161 pthread_t threads[kThreads]; in TEST() local [all …]
|
| /openbsd-src/gnu/usr.bin/perl/ext/XS-APItest/t/ |
| H A D | boolean-thr.t | 13 use threads; 14 use threads::shared; 16 ok(threads->create( sub { SvIsBOOL($_[0]) }, !!0 )->join, 19 ok(SvIsBOOL(threads->create( sub { return !!0 } )->join), 24 ok(threads->create( sub { SvIsBOOL($var) } )->join, 34 ok(threads->create( sub { SvIsBOOL($sharedvar) } )->join,
|