clause.d

来自「Sun Solaris 10 中的 DTrace 组件的源代码。请参看: htt」· D 代码 · 共 30 行

D
30
字号
int me;			/* an integer global variable */this int foo;		/* an integer clause-local variable */tick-1sec{	/*	 * Set foo to be 10 if and only if this is the first clause executed.	 */	this->foo = (me % 3 == 0) ? 10 : this->foo;	printf("Clause 1 is number %d; foo is %d\n", me++ % 3, this->foo++);}tick-1sec{	/*	 * Set foo to be 20 if and only if this is the first clause executed. 	 */	this->foo = (me % 3 == 0) ? 20 : this->foo;	printf("Clause 2 is number %d; foo is %d\n", me++ % 3, this->foo++);}tick-1sec{	/*	 * Set foo to be 30 if and only if this is the first clause executed.	 */	this->foo = (me % 3 == 0) ? 30 : this->foo;	printf("Clause 3 is number %d; foo is %d\n", me++ % 3, this->foo++);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?