-preemptable-interrupts
指定表示可抢占中断的函数
语法
-preemptable-interrupts
function1
[,function2
[,...]]
描述
-preemptable-interrupts
指定表示可抢占中断的函数。function1
[,function2
[,...]]
除了可以被其他中断(可抢占或不可抢占)中断之外,该函数在所有方面的表现都像是一个中断。中断是通过中断 (-interrupts)
选项指定的。有关示例,请参阅Define Task Priorities for Data Race Detection in Polyspace。
要将某个函数指定为可抢占中断,必须先将该函数指定为中断。您指定的函数必须具有以下原型:
void function_name(void);
在用户界面(仅限 Polyspace® 桌面端产品)中,在配置窗格的其他字段中输入此选项。请参阅其他
。
示例
以下面的程序为例。假设函数 task1
和 task2
表示中断。
int x; void task1() { x++; } void task2() { x = 0; } void main() { }
要指定 task1
和 task2
是周期任务,请输入以下命令:
polyspace-bug-finder -sources filename -interrupts task1,task2
task1
和 task2
中的操作不能相互中断。默认情况下,指定为中断的函数不可抢占。将 task1
指定为可抢占中断。
polyspace-bug-finder -sources multi.c -interrupts task1,task2 -preemptable-interrupts task1
task1
中的 x++
操作可能会被 task2
中的操作中断。提示
在 Polyspace as You Code 分析中,此选项无用。
Code Prover 解释此选项时有一些限制,因为 Code Prover 认为所有操作都可能是非原子且可中断的。这种过度近似会导致此选项在某些情况下被忽略。有关示例,请参阅Effect of Task Priorities in Code Prover (Polyspace Code Prover)。
版本历史记录
在 R2016b 中推出