【发布时间】:2015-01-30 01:14:07
【问题描述】:
我有以下结构:
struct sched_param {
union {
int sched_priority;
struct lshort_sched_param lshort_params;
};
};
struct lshort_sched_param {
int requested_time;
int level;
};
每当我创建sched_param param1 结构并尝试更新param1.sched_priority 字段时,我都会收到主题中写入的消息。
struct sched_param param1;
param1.sched_priority = 1;
但是,每当我创建 sched_param param2 并尝试更新 param2.lshort_params.level 时,它都可以正常工作。
struct sched_param param2;
param2.lshort_params.level= 1;
可能是什么原因?
【问题讨论】:
-
你需要给联合一个标识符,所以它可以被引用。
-
这是在家庭作业中给我们的结构,所以我不能给工会起个名字。还有其他解决办法吗?
标签: c linux linux-kernel