Ticket #484 (closed bug: fixed)
illegal instruction/segfault with Timer PMC
|Reported by:||coke||Owned by:||whiteknight|
.include 'timer.pasm' # for the timer constants .sub expired say 'Timer has expired!' exit 1 .end .sub main :main $P0 = new 'Timer' $P1 = get_global "expired" $P0[.PARROT_TIMER_HANDLER] = $P1 # call sub in $P1 when timer goes off $P0[.PARROT_TIMER_SEC] = 2 # trigger in 10 seconds $P0[.PARROT_TIMER_REPEAT] = -1 # repeat indefinitely $P0[.PARROT_TIMER_RUNNING] = 1 # start timer immediately set_global "timer", $P0 # keep the timer around $I0 = 0 loop: print $I0 say ": running..." inc $I0 sleep 1 # wait a second goto loop .end
This generates an illegal instruction. Changing the -1 to a positive one, works as expected.
Note: See TracTickets for help on using tickets.