os-sim.h
typedef enum {
PROCESS_NEW = 0,
PROCESS_READY,
PROCESS_RUNNING,
PROCESS_WAITING,
PROCESS_TERMINATED
} process_state_t;
typedef struct _pcb_t {
const unsigned int pid;
const char *name;
const unsigned int static_priority;
process_state_t state; <<---Trying to access this
op_t *pc;
struct _pcb_t *next;
} pcb_t;
file1.c
static pcb_t **current;
extern void yield(unsigned int cpu_id)
{
/* FIX ME */
while (1)
{
pthread_mutex_lock(¤t_mutex);
current[cpu_id].state = PROCESS_WAITING; ///<-------ERROR HERE
pthread_mutex_unlock(¤t_mutex);
break;
}
schedule(cpu_id);
}
in main method():
current = malloc(sizeof(pcb_t*) * 10);
この行にエラーがありますcurrent[cpu_id].state = PROCESS_WAITING;
error: request for member ‘state’ in something not a structure or union
このエラーはどういう意味ですか?
これは、pcb_t を保持する現在の配列にアクセスする正しい方法ではありませんか?
もしそうなら、どうすれば現在の配列にアクセスできますか? 状態フィールド?