changed EABORT to ETIMEOUT for marking timeouts

master
Anton Lydike 3 years ago
parent b429c460a1
commit 8fdff36c65

@ -13,7 +13,7 @@ enum error_code {
ENOMEM = 3, // not enough memory ENOMEM = 3, // not enough memory
ENOBUFS = 4, // no space left in buffer ENOBUFS = 4, // no space left in buffer
ESRCH = 5, // no such process ESRCH = 5, // no such process
EABORT = 6 ETIMEOUT= 6 // timeout while waiting
}; };
/* /*
@ -33,16 +33,18 @@ struct loaded_binary;
struct process_control_block { struct process_control_block {
int pid; int pid;
// state information
int pc; int pc;
int regs[31]; int regs[31];
int exit_code; int exit_code;
// scheduling information // scheduling information
enum process_status status; enum process_status status;
struct process_control_block* waiting_for_process; struct process_control_block* waiting_for_process;
struct loaded_binary* binary;
unsigned long long int asleep_until; unsigned long long int asleep_until;
// parent // hierarchical information
struct loaded_binary* binary;
struct process_control_block* parent; struct process_control_block* parent;
// memory management information
void* stack_top; void* stack_top;
}; };

@ -103,7 +103,7 @@ struct process_control_block* scheduler_select_free()
if (pcb->asleep_until != 0) { if (pcb->asleep_until != 0) {
if (pcb->asleep_until < mtime) { if (pcb->asleep_until < mtime) {
// if the timeout ran out, set an error code // if the timeout ran out, set an error code
pcb->regs[REG_A0 + 1] = EABORT; pcb->regs[REG_A0 + 1] = ETIMEOUT;
pcb->status = PROC_RDY; pcb->status = PROC_RDY;
return pcb; return pcb;
} }

Loading…
Cancel
Save