Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge deprecate_tqueue branch into trunk. This removes the Tqueue PMC…

… from Parrot.

git-svn-id: https://svn.parrot.org/parrot/trunk@37029 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
commit 85bf6e46b76768da7b941dac7120489d668cb734 1 parent 52113c9
@jkeenan jkeenan authored
View
6 MANIFEST
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Wed Feb 25 17:00:32 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Fri Feb 27 02:52:49 2009 UT
#
# See tools/dev/install_files.pl for documentation on the
# format of this file.
@@ -717,7 +717,6 @@ examples/pir/quine_ord.pir [examples]
examples/pir/readline.pir [examples]
examples/pir/substr.pir [examples]
examples/pir/sudoku.pir [examples]
-examples/pir/thr-primes.pir [examples]
examples/pir/uniq.pir [examples]
examples/sdl/anim_image.pir [examples]
examples/sdl/anim_image_dblbuf.pir [examples]
@@ -2242,7 +2241,6 @@ src/pmc/stringhandle.pmc [devel]src
src/pmc/sub.pmc [devel]src
src/pmc/task.pmc [devel]src
src/pmc/timer.pmc [devel]src
-src/pmc/tqueue.pmc [devel]src
src/pmc/undef.pmc [devel]src
src/pmc/unmanagedstruct.pmc [devel]src
src/pmc_freeze.c []
@@ -2307,6 +2305,7 @@ t/codingstd/fixme.t [test]
t/codingstd/gmt_utc.t [test]
t/codingstd/linelength.t [test]
t/codingstd/make_code_coda.t [test]
+t/codingstd/pbc_compat.t [test]
t/codingstd/pccmethod_deps.t [test]
t/codingstd/pdd_format.t [test]
t/codingstd/perlcritic.t [test]
@@ -2690,7 +2689,6 @@ t/pmc/sys.t [test]
t/pmc/task.t [test]
t/pmc/threads.t [test]
t/pmc/timer.t [test]
-t/pmc/tqueue.t [test]
t/pmc/undef.t [test]
t/pmc/unmanagedstruct.t [test]
t/postconfigure/01-options.t [test]
View
8 PBC_COMPAT
@@ -27,7 +27,8 @@
# please insert tab separated entries at the top of the list
-3.36 2000.02.20 coke removed closure PMC
+3.37 2009.02.26 jkeenan removed tqueue PMC
+3.36 2009.02.20 coke removed closure PMC
3.35 2009.02.15 rurban added bignum.pmc
3.34 2009.01.23 coke removed intlist, enumerate, multiarray, pair, delegate, deleg_pmc PMCs
3.33 2009.01.20 chromatic removed n_neg opcode
@@ -60,7 +61,7 @@
3.06 2007.11.28 coke remove classname opcode
3.05 2007.10.29 allison add get_eh, get_all_eh, and count_eh opcodes
3.04 2007.10.28 paultcochrane remove clear_eh opcode
-3.03 2007.10.17 coke released 0.4.17
+3.03 2007.10.17 coke released 0.4.17
3.02 2007.09.20 bernhard remove opcode hash
3.02 2007.09.07 bernhard deprecate opcode substr_r
3.01 2007.08.17 chromatic store HLL names as strings in frozen Sub PMCs
@@ -77,7 +78,8 @@
2.17 2007.01.16 particle released 0.4.8
2.16 2006.12.16 paultcochrane deleted fetchmethod opcode
2.15 2006.11.14 chip released 0.4.7
-2.14 2006.11.07 tewk added comp_flags to parrot_sub_t
+2.14 2006.11.07 tewk added comp_flags to parrot_sub_t
+2.14 2006.11.07 tewk added comp_flags to parrot_sub_t
2.13 2006.09.23 bernhard remove ops from dotgnu.ops
2.12 2006.08.18 leo removed None PMC from parrot core
2.11 2006.08.16 creiss added STM opcodes
View
11 docs/book/ch05_pasm.pod
@@ -2313,11 +2313,12 @@ threads are still under development, so you can expect significant
changes in the near future.
As outlined in the previous chapter, Parrot implements three different
-threading models. The following example uses the third model, which
-takes advantage of shared data. It uses a C<TQueue> (thread-safe
-queue) object to synchronize the two parallel running threads. This
-is only a simple example to illustrate threads, not a typical usage of
-threads (no-one really wants to spawn two threads just to print out a
+threading models. (B<Note>: As of version 1.0, the C<TQueue> PMC will be
+deprecated, rendering the following discussion obsolete.) The following
+example uses the third model, which takes advantage of shared data. It uses a
+C<TQueue> (thread-safe queue) object to synchronize the two parallel running
+threads. This is only a simple example to illustrate threads, not a typical
+usage of threads (no-one really wants to spawn two threads just to print out a
simple string).
find_global P5, "_th1" # locate thread function
View
2  editor/pir-mode.el
@@ -156,7 +156,7 @@ newline or semicolon after an end keyword."
"ParrotRunningThread" "ParrotThread" "Pointer" "Random" "Ref"
"ResizableBooleanArray" "ResizableFloatArray" "ResizableIntegerArray"
"ResizablePMCArray" "ResizableStringArray" "RetContinuation"
- "Role" "Scalar" "SharedRef" "Slice" "String" "Sub" "Super" "TQueue"
+ "Role" "Scalar" "SharedRef" "Slice" "String" "Sub" "Super"
"Timer" "UnManagedStruct" "Undef" "VtableCache"))
(defvar pir-ops
View
170 examples/pir/thr-primes.pir
@@ -1,170 +0,0 @@
-# Copyright (C) 2001-2008, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-examples/pir/thr-primes.pir - Threads
-
-=head1 SYNOPSIS
-
- % ./parrot examples/pir/thr-primes.pir
-
-=head1 DESCRIPTION
-
-A threaded primes example.
-
-From C<perldoc perlthrtut>:
-
- 1 #!/usr/bin/perl -w
- 2 # prime-pthread, courtesy of Tom Christiansen
- 3
- 4 use strict;
- 5
- 6 use threads;
- 7 use Thread::Queue;
- 8
- 9 my $stream = new Thread::Queue;
- 10 my $kid = new threads(\&check_num, $stream, 2);
- 11
- 12 for my $i ( 3 .. 1000 ) {
- 13 $stream->enqueue($i);
- 14 }
- 15
- 16 $stream->enqueue(undef);
- 17 $kid->join;
- 18
- 19 sub check_num {
- 20 my ($upstream, $cur_prime) = @_;
- 21 my $kid;
- 22 my $downstream = new Thread::Queue;
- 23 while (my $num = $upstream->dequeue) {
- 24 next unless $num % $cur_prime;
- 25 if ($kid) {
- 26 $downstream->enqueue($num);
- 27 } else {
- 28 print "Found prime $num\n";
- 29 $kid = new threads(\&check_num, $downstream, $num);
- 30 }
- 31 }
- 32 $downstream->enqueue(undef) if $kid;
- 33 $kid->join if $kid;
- 34 }
-
-=cut
-
-# translate to PIR by leo
-
-# Runs here (i386/linux 256MB mem) w.
-# ARENA_GC_FLAGS = 1 MAX=500 (~ 95 threads)
-# ARENA_GC_FLAGS = 0 MAX=1000 (~ 168 threads)
-
-
-.sub _main
- .param pmc argv
- .const int MAX = 500
- .local int max
- .local pmc kid
- .local pmc Check_num
- .local pmc stream
- .local int argc
- argc = argv
- max = MAX
- if argc < 2 goto no_arg
- $S0 = argv[1]
- max = $S0
-no_arg:
-
- #sweepoff
-# 9 my $stream = new Thread::Queue;
- stream = new 'TQueue'
-# 10 my $kid = new threads(\&check_num, $stream, 2);
- Check_num = get_global "_check_num"
- kid = new 'ParrotThread'
- $P2 = new 'Integer'
- $P2 = 2
- kid.'run_clone'(Check_num, Check_num, stream, $P2)
-
-# 12 for my $i ( 3 .. 1000 ) {
- .local int i
- i = 3
-lp:
-# 13 $stream->enqueue($i);
- $P3 = new 'Integer'
- $P3 = i
- push stream, $P3
- inc i
- if i <= max goto lp
-# 14 }
-
-# 16 $stream->enqueue(undef);
- $P4 = new 'Undef'
- push stream, $P4
-
-# 17 $kid->join;
- kid.'join'()
-.end
-
-# 19 sub check_num {
-# 20 my ($upstream, $cur_prime) = @_;
-# XXX still no comments inside pcc param block
-.sub _check_num
- .param pmc sub
- .param pmc upstream
- .param pmc cur_prime
-
-# 21 my $kid;
- .local pmc kid
- kid = new 'Undef'
-# 22 my $downstream = new Thread::Queue;
- .local pmc downstream
- downstream = new 'TQueue'
-# 23 while (my $num = $upstream->dequeue) {
- .local pmc Num # num is a reserved word
-lp:
- shift Num, upstream
- $I0 = defined Num
- unless $I0 goto ewhile
-# 24 next unless $num % $cur_prime;
- $P0 = new 'Integer'
- $P0 = Num % cur_prime
- unless $P0 goto lp
-# 25 if ($kid) {
- $I1 = defined kid
- unless $I1 goto no_kid1
-# 26 $downstream->enqueue($num);
- push downstream, Num
- goto lp
-# 27 } else {
-no_kid1:
-# 28 print "Found prime $num\n";
- print "Found prime "
- print Num
- print "\n"
-
-# 29 $kid = new threads(\&check_num, $downstream, $num);
- kid = new 'ParrotThread'
- kid.'run_clone'(sub, sub, downstream, Num)
- goto lp
-# 31 }
-ewhile:
-
-# 32 $downstream->enqueue(undef) if $kid;
- $I1 = defined kid
- unless $I1 goto no_kid2
-
- $P4 = new 'Undef'
- push downstream, $P4
-
-# 33 $kid->join if $kid;
- kid.'join'()
-
-no_kid2:
-# 34 }
- # sleep 1 # turn on for watching memory usage
-.end
-
-# Local Variables:
-# mode: pir
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
View
10 src/pmc/pmc.num
@@ -75,10 +75,8 @@ orderedhash.pmc 49
# other
-tqueue.pmc 50
+parrotclass.pmc 50
+parrotobject.pmc 51
-parrotclass.pmc 51
-parrotobject.pmc 52
-
-os.pmc 53
-file.pmc 54
+os.pmc 52
+file.pmc 53
View
283 src/pmc/tqueue.pmc
@@ -1,283 +0,0 @@
-/*
-Copyright (C) 2001-2008, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/tqueue.pmc - Threadsafe Queue
-
-=head1 DESCRIPTION
-
-Threadsafe queue class for inter thread communication. If you have an
-unthreaded program then please use an Array-like PMC.
-
- new P0, 'TQueue'
- push P0, some
- new P2, 'ParrotThread'
- ...
-
-and in other thread (at least, when shared PMCs work :)
-
- shift P1, P0
-
-Note: The TQueue must always be emptied before program exit.
-
-=head2 Methods
-
-=over 4
-
-=cut
-
-*/
-
-#include "parrot/parrot.h"
-
-pmclass TQueue need_ext is_shared {
- ATTR struct QUEUE *queue;
- ATTR INTVAL thread_count;
-
-/*
-
-=item C<void init()>
-
-Initializes the queue.
-
-=cut
-
-*/
-
- VTABLE void init() {
- Parrot_TQueue_attributes* attrs =
- mem_allocate_zeroed_typed(Parrot_TQueue_attributes);
-
- attrs->thread_count = 0;
- attrs->queue = queue_init(0);
- PMC_data(SELF) = attrs;
-
- PObj_custom_mark_destroy_SETALL(SELF);
- }
-
-/*
-
-=item C<PMC *clone()>
-
-Returns the queue itself. No copy is made.
-
-=cut
-
-*/
-
- VTABLE PMC *clone() {
- /* XXX fake a shared PMC */
- return SELF;
- }
-
-/*
-
-=item C<void mark()>
-
-Marks all the threads in the queue as live.
-
-=cut
-
-*/
-
- VTABLE void mark() {
- QUEUE *queue;
- QUEUE_ENTRY *entry;
-
- GET_ATTR_queue(INTERP, SELF, queue);
-
- queue_lock(queue);
- entry = queue->head;
-
- while (entry) {
- pobject_lives(INTERP, (PObj *)entry->data);
-
- if (entry == queue->tail)
- break;
-
- entry = entry->next;
- }
-
- queue_unlock(queue);
- }
-
-/*
-
-=item C<void destroy()>
-
-Destroys the queue.
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- QUEUE *queue;
- GET_ATTR_queue(INTERP, SELF, queue);
-
- if (queue) {
-#if 0
- /*
- * wait til queue is empty
- * XXX implement a time wait and PANIC if queue
- * isn't empty after some TIMEOUT
- */
- while (SELF.elements()) {
- queue_lock(queue);
- queue_wait(queue);
- queue_unlock(queue);
- }
-#endif
- mem_sys_free(queue);
- }
- mem_sys_free(PMC_data(SELF));
- }
-
-/*
-
-=item C<INTVAL defined()>
-
-Returns whether there are any threads in the queue.
-
-=cut
-
-*/
-
- VTABLE INTVAL defined() {
- return SELF.get_integer() != 0;
- }
-
-/*
-
-=item C<INTVAL get_integer()>
-
-=cut
-
-*/
-
- VTABLE INTVAL get_integer() {
-
- INTVAL thread_count;
- GET_ATTR_thread_count(INTERP, SELF, thread_count);
- return thread_count;
- }
-
-/*
-
-=item C<INTVAL elements()>
-
-Returns the number of threads in the queue.
-
-=cut
-
-*/
-
- VTABLE INTVAL elements() {
- return SELF.get_integer();
- }
-
-/*
-
-=item C<void push_pmc(PMC *item)>
-
-Adds the thread C<*item> to the end of the queue.
-
-=cut
-
-*/
-
- void push_pmc(PMC *item) {
- QUEUE_ENTRY * const entry = mem_allocate_typed(QUEUE_ENTRY);
- QUEUE * queue;
- INTVAL thread_count;
-
- GET_ATTR_queue(INTERP, SELF, queue);
-
- /*
- * if item isn't shared nor const, then make
- * a shared item
- */
- if (!(item->vtable->flags &
- (VTABLE_IS_CONST_FLAG | VTABLE_IS_SHARED_FLAG)))
- VTABLE_share(INTERP, item);
-
- GC_WRITE_BARRIER(INTERP, SELF, NULL, item);
-
- entry->data = item;
- entry->type = QUEUE_ENTRY_TYPE_NONE;
-
- /* s. tsq.c:queue_push */
- queue_lock(queue);
-
- GET_ATTR_thread_count(INTERP, SELF, thread_count);
- ++thread_count;
- SET_ATTR_thread_count(INTERP, SELF, thread_count);
-
- /* Is there something in the queue? */
- if (queue->tail) {
- queue->tail->next = entry;
- queue->tail = entry;
- }
- else {
- queue->head = entry;
- queue->tail = entry;
- }
-
- /* signal all waiters */
- queue_broadcast(queue);
- queue_unlock(queue);
- }
-
-/*
-
-=item C<PMC *shift_pmc()>
-
-Removes the first thread from the start of the queue.
-
-=cut
-
-*/
-
- VTABLE PMC *shift_pmc() {
- QUEUE *queue;
- QUEUE_ENTRY *entry;
- PMC *ret;
- INTVAL thread_count;
-
- GET_ATTR_queue(INTERP, SELF, queue);
- queue_lock(queue);
-
- while (queue->head == NULL) {
- queue_wait(queue);
- }
-
- entry = nosync_pop_entry(queue);
- GET_ATTR_thread_count(INTERP, SELF, thread_count);
- --thread_count;
- SET_ATTR_thread_count(INTERP, SELF, thread_count);
-
- queue_unlock(queue);
-
- ret = (PMC *)entry->data;
- mem_sys_free(entry);
-
- return ret;
- }
-}
-
-/*
-
-=back
-
-=cut
-
-*/
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
View
54 t/codingstd/pbc_compat.t
@@ -0,0 +1,54 @@
+#! perl
+# Copyright (C) 2006-2009, Parrot Foundation.
+# $Id$
+use strict;
+use warnings;
+use Carp;
+use Test::More tests => 2;
+
+my $pbcc = q{PBC_COMPAT};
+croak "Cannot locate $pbcc: $!" unless (-f $pbcc);
+
+my @malformed = ();
+my @badversion =();
+open my $IN, '<', $pbcc or croak "Unable to open $pbcc for reading: $!";
+while (my $l = <$IN>) {
+ chomp $l;
+ next if $l =~ m/^(?:#|\s*$)/o;
+ push @malformed, $. unless $l =~ m/^([^\t]+)\t[^\t]+\t[^\t]+\t[^\t]+$/o;
+ my $version = $1;
+ push @badversion, $. unless $version =~ m/^\d+\.\d+$/o;
+}
+close $IN or croak "Unable to close $pbcc after reading: $!";
+is( scalar( @malformed ), 0, "All records in $pbcc are properly formatted" )
+ or diag( "These lines in $pbcc are malformed: @malformed\n" );
+is( scalar( @badversion ), 0, "All records in $pbcc have valid version numbers" )
+ or diag( "These lines in $pbcc have bad version numbers: @badversion\n" );
+
+=head1 NAME
+
+t/codingstd/pbc_compat.t - Enforce PBC_COMPAT's record format
+
+=head1 SYNOPSIS
+
+ % prove t/codingstd/pbc_compat.t
+
+=head1 DESCRIPTION
+
+PBC_COMPAT records the history of changes to Parrot's bytecode format.
+Entries in this file must, per specifications in the file itself, consist of
+four hard-tab-delimited columns. The first of these columns is the bytecode
+version number, which must be in C<N.N> format, where each C<N> increases
+monotonically. This test file enforces this coding standard.
+
+We assume that this file is run from the top-level directory of the Parrot
+distribution.
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
View
68 t/op/gc.t
@@ -6,7 +6,7 @@ use strict;
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 20;
+use Parrot::Test tests => 19;
=head1 NAME
@@ -474,72 +474,6 @@ CODE
ok
OUTPUT
-pasm_output_is( <<'CODE', <<OUTPUT, "write barrier 4 - tqueue" );
- null I2
- set I3, 100
-lp3:
- null I0
- set I1, 10
- new P5, 'TQueue'
- new P0, 'Integer'
- needs_destroy P0
- # force partial sweep
- # P5 should now be black
- sweep 0
- # store white queue P1 in black P5 - needs a barrier
- new P1, 'TQueue'
- push P5, P1
- null P1
- new P0, 'Integer'
- needs_destroy P0
- # force sweep
- sweep 0
- shift P1, P5
- push P5, P1
-lp1:
- new P0, 'Integer'
- needs_destroy P0
- # force sweep
- sweep 0
- set P0, I0
- new P2, 'TQueue'
- push P2, P0
- push P1, P2
- new P3, 'Undef'
- new P4, 'Undef'
- inc I0
- lt I0, I1, lp1
-
- null I0
- shift P1, P5
-lp2:
- shift P2, P1
- shift P2, P2
- eq P2, I0, ok
- print "nok\n"
- print "I0: "
- print I0
- print " P2: "
- print P2
- print " type: "
- typeof S0, P2
- print S0
- print " I2: "
- print I2
- print "\n"
- exit 1
-ok:
- inc I0
- lt I0, I1, lp2
- inc I2
- lt I2, I3, lp3
- print "ok\n"
- end
-
-CODE
-ok
-OUTPUT
-
pir_output_is( <<'CODE', <<'OUTPUT', "verify pmc proxy object marking" );
.sub main :main
.local pmc cl, s, t
View
209 t/pmc/threads.t
@@ -46,7 +46,7 @@ if ( $^O eq "cygwin" ) {
}
}
if ( $platforms{$^O} ) {
- plan tests => 20;
+ plan tests => 15;
}
else {
plan skip_all => "No threading yet or test not enabled for '$^O'";
@@ -288,36 +288,6 @@ CODE
500500
OUTPUT
-
-pir_output_like( <<'CODE', <<'OUTPUT', "detach" );
-.sub main :main
- .local pmc foo
- .local pmc queue
- .local pmc thread
- foo = get_global '_foo'
- queue = new ['TQueue'] # flag for when the thread is done
- thread = new ['ParrotThread']
- thread.'run_clone'(foo, queue)
-
- thread.'detach'()
-wait:
- defined $I0, queue
- if $I0 == 0 goto wait
- print "done\n"
-.end
-
-.sub _foo
- .param pmc queue
- print "thread\n"
- sleep 0.1
- $P1 = new ['Integer']
- push queue, $P1
-.end
-CODE
-/(done\nthread\n)|(thread\ndone\n)/
-OUTPUT
-
-
pir_output_is( <<'CODE', <<'OUTPUT', "share a PMC" );
.sub main :main
.local pmc foo
@@ -354,54 +324,6 @@ done
21
OUTPUT
-pir_output_is( <<'CODE', <<'OUT', "multi-threaded" );
-.sub main :main
- .local pmc queue
- queue = new ['TQueue']
- .local pmc tmpInt
- tmpInt = new ['Integer']
- tmpInt = 1
- push queue, tmpInt
- tmpInt = new ['Integer']
- tmpInt = 2
- push queue, tmpInt
- tmpInt = new ['Integer']
- tmpInt = 3
- push queue, tmpInt
-
- .local pmc thread
- thread = new ['ParrotThread']
- .local pmc foo
- foo = get_global '_foo'
- thread.'run_clone'(foo, queue)
- thread.'join'()
- print "done main\n"
-.end
-
-.sub _foo
- .param pmc queue
- $I0 = queue
- print $I0
- print "\n"
-loop:
- $I0 = queue
- if $I0 == 0 goto done
- shift $P0, queue
- print $P0
- print "\n"
- branch loop
-done:
- print "done thread\n"
-.end
-CODE
-3
-1
-2
-3
-done thread
-done main
-OUT
-
pir_output_is( <<'CODE', <<'OUT', "sub name lookup in new thread" );
.sub check
$P0 = get_global ['Foo'], 'foo'
@@ -1016,135 +938,6 @@ ok (equal)
42
OUTPUT
-pir_output_is( <<'CODE', <<'OUT', 'multi-threaded strings via SharedRef' );
-.sub main :main
- .local pmc queue
- .local pmc tmp_string
- .local pmc shared_ref
-
- queue = new ['TQueue']
- tmp_string = new ['String']
- tmp_string = "ok 1\n"
- shared_ref = new ['SharedRef'], tmp_string
- push queue, shared_ref
- tmp_string = new ['String']
- tmp_string = "ok 2\n"
- shared_ref = new ['SharedRef'], tmp_string
- push queue, shared_ref
- tmp_string = new ['String']
- tmp_string = "ok 3\n"
- shared_ref = new ['SharedRef'], tmp_string
- push queue, shared_ref
-
- .local pmc thread
- .local pmc foo
-
- thread = new ['ParrotThread']
- foo = get_global '_foo'
- thread.'run_clone'(foo, queue)
- thread.'join'()
- print "done main\n"
-.end
-
-.sub _foo
- .param pmc queue
- $I0 = queue
- print $I0
- print "\n"
-loop:
- $I0 = queue
- if $I0 == 0 goto done
- shift $P0, queue
- print $P0
- branch loop
-done:
- print "done thread\n"
-.end
-CODE
-3
-ok 1
-ok 2
-ok 3
-done thread
-done main
-OUT
-
-SKIP: {
- skip( "no shared Strings yet", 2 );
- pasm_output_is( <<'CODE', <<'OUT', "thread safe queue strings 1" );
- new P10, ['TQueue']
- print "ok 1\n"
- set I0, P10
- print I0
- print "\n"
- new P7, ['String']
- set P7, "ok 2\n"
- push P10, P7
- new P7, ['String']
- set P7, "ok 3\n"
- push P10, P7
- set I0, P10
- print I0
- print "\n"
-
- shift P8, P10
- print P8
- shift P8, P10
- print P8
- end
-CODE
-ok 1
-0
-2
-ok 2
-ok 3
-OUT
-
- pasm_output_is( <<'CODE', <<'OUT', "multi-threaded strings" );
- new P10, ['TQueue']
- new P7, ['String']
- set P7, "ok 1\n"
- push P10, P7
- new P7, ['String']
- set P7, "ok 2\n"
- push P10, P7
- new P7, ['String']
- set P7, "ok 3\n"
- push P10, P7
- set P6, P10
-
- get_global P5, "_foo"
- new P2, ['ParrotThread']
- callmethod "thread3"
- set I5, P2
- getinterp P2
- callmethod "join"
- print "done main\n"
- end
-
-.pcc_sub _foo:
- set I0, P6
- print I0
- print "\n"
-loop:
- set I0, P6
- unless I0, ex
- shift P8, P6
- print P8
- branch loop
-ex:
- print "done thread\n"
- returncc
-CODE
-3
-ok 1
-ok 2
-ok 3
-done thread
-done main
-OUT
-}
-
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
View
61 t/pmc/tqueue.t
@@ -1,61 +0,0 @@
-#! parrot
-# Copyright (C) 2001-2005, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/tqueue.t - Thread Queue
-
-=head1 SYNOPSIS
-
- % prove t/pmc/tqueue.t
-
-=head1 DESCRIPTION
-
-Tests the thread queue.
-
-=cut
-
-.sub main :main
- .include "include/test_more.pir"
- plan(5)
- thread_safe_queue_tests()
-.end
-
-.sub thread_safe_queue_tests
- .local int i, is_ok
- .local pmc tq, pInt
-
- new tq, ['TQueue']
- ok(1, "didn't crash")
-
- i = tq
- is_ok = i == 0
- ok(is_ok, "int assignment gets # of elements in empty queue")
-
- pInt = new ['Integer']
- pInt = 2
- push tq, pInt
- pInt = new ['Integer']
- pInt = 3
- push tq, pInt
- i = tq
- is_ok = i == 2
- ok(is_ok, "int assignment gets # of elements in non-empty queue")
-
- shift pInt, tq
- i = pInt
- is_ok = i == 2
- ok(is_ok, "int retrieval works")
- shift pInt, tq
- i = pInt
- is_ok = i == 3
- ok(is_ok, "int retrieval works")
-.end
-
-# Local Variables:
-# mode: pir
-# cperl-indent-level: 4
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
View
1  t/steps/auto_pmc-01.t
@@ -184,7 +184,6 @@ my @dummy_options = qw(
fixedstringarray.pmc
hash.pmc
orderedhash.pmc
- tqueue.pmc
os.pmc
file.pmc
addrregistry.pmc
Please sign in to comment.
Something went wrong with that request. Please try again.