以下代码段由单个进程中的多个线程定期调用。这里的问题是,是否有关键部分?
第一个代码:
struct object {
struct object *nxt;
};
void delete(object **top, object *deletable) {
object *current, *pred;
if (*top == deletable) {
*top = deletable->nxt;
} else {
pred = top;
current = (*top)->nxt;
while (current && (current != deletable)) {
pred = current;
current = current->nxt;
}
if (current) {
pred = current->nxt;
}
}
第二代码;
int shift(int param) {
int result = 654321;
result = result ^ param;
param = param * result;
result = (param >> 9) ^ ~result;
return result;
}
目前我认为没有任何关键部分,因为变量不会操纵相同的数据。但我不确定这一点。我对关键部分和多线程很陌生。