File: rtos1.pml

package info (click to toggle)
spin 6.5.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,512 kB
  • sloc: ansic: 39,876; yacc: 1,021; makefile: 58; sh: 13
file content (32 lines) | stat: -rwxr-xr-x 654 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
byte cnt;

/* the use of 'priority' tags enforces
   priority based scheduling
   it can be combined freely with provided clauses as well
   to finetune the scheduling choices
 */

active proctype medium() priority 5
{
	set_priority(0, 8);
	printf("medium %d - pid %d pr %d pr1 %d\n", _priority, _pid, get_priority(_pid), get_priority(0));
	cnt++
}

active proctype high() priority 10
{
	_priority = 9;
	printf("high %d\n", _priority);
	cnt++
}

active proctype low() priority 1
{
	/*
	 * can only execute if this is the highest
	 * priority process with executable statements
	 */

	assert(_priority == 1 && cnt == 2);
	printf("low %d\n", _priority);
}