Skip to content

Instantly share code, notes, and snippets.

@Whiteknight
Created October 27, 2011 17:46
Show Gist options
  • Save Whiteknight/1320270 to your computer and use it in GitHub Desktop.
Save Whiteknight/1320270 to your computer and use it in GitHub Desktop.
updated code for nine
#!./parrot
.include "interpinfo.pasm"
.sub main :main
.local pmc task, sayer, name, starter, number
.local int i
sayer = get_global 'sayer'
starter = new ['Integer']
set_global 'starter', starter
i = 0
starter = 0
start:
task = new ['Task']
setattribute task, 'code', sayer
number = new ['String']
number = i
setattribute task, 'data', number
print "scheduling "
say number
print "\tpmcs: "
$I0 = interpinfo .INTERPINFO_ACTIVE_PMCS
say $I0
print "\tbuffers: "
$I0 = interpinfo .INTERPINFO_ACTIVE_BUFFERS
say $I0
print "\ttotal mem: "
$I0 = interpinfo .INTERPINFO_TOTAL_MEM_USED
say $I0
schedule task
inc i
if i > 200 goto end
goto start
end:
starter = 1
.end
.sub sayer
.param pmc name
.local pmc starter
.local int i
starter = get_global 'starter'
start:
if starter > 0 goto run
sleep 0.001
goto start
run:
say name
.end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment