BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / blob / 4d3c382801026ca46da937de6d7261f1f6805d9e / include / nucleus / task.h

// Related

Nucleus

Barry Object Lists + replacing Task Queues 4d3c382 (3 years, 3 months ago)
#ifndef _NUCLEUS_TASK_H
#define _NUCLEUS_TASK_H

#include <stdint.h>
#include <sys/types.h>
#include <nucleus/cpu.h>
#include <nucleus/object.h>
#include <nucleus/memory.h>

typedef struct Task Task;

/* Task priorities */
enum Priority {
	NONE,
	LOWEST,
	LOW,
	NORMAL,
	HIGH,
	HIGHEST,
};

/* Task states */
enum State {
	RUNNING,
	READY,
	TERMINATED,
};

/* Structure for a Task */
struct Task {
	Object obj;
	pid_t tid;
	enum Priority priority;
	enum State state;

	uintptr_t esp, ebp, eip;
	page_dir_t pageDir;
};

extern ObjectType taskType;

extern Task *currentTask[];
#define current currentTask[CPUID]

void init_tasking(void);
void schedule(void);
pid_t clone(int flags);

#endif