[chuck-users] sporking shreds, advancing time

vb vboehm at gmx.ch
Thu Oct 5 09:52:03 EDT 2006


hi all,
i'm still struggling with the basics of chuck, it seems.

let's say i have a process i want to have executed regularly, like a  
simple click of an impulse.
is it more appropriate for chuck's liking to advance time inside the  
impulse function and spork it only once,
or to spork the impulse function regularly?
volker.

// begin example 1

Impulse i => dac;

fun void click() {
	while(true) {
		1.0 => i.next;
		0.5::second => now;
	}
}

spork ~click();

while( true )
	1::second => now;

// end example 1


// begin example 2

Impulse i => dac;

fun void click() {
	1.0 => i.next;
}


while( true ) {
	spork ~click();
	0.5::second => now;
}

// end example 2


More information about the chuck-users mailing list