Max OS 0.3
Loading...
Searching...
No Matches
scheduler_resources.h
Go to the documentation of this file.
1
10#ifndef MAXOS_PROCESSES_RESOURCES_SCHEDULER_RESOURCES_H
11#define MAXOS_PROCESSES_RESOURCES_SCHEDULER_RESOURCES_H
12
13
14#include <stddef.h>
15#include <stdint.h>
16
17#include <libkpi/processes/thread.h>
18#include <libkpi/processes/process.h>
19
20#include <processes/process.h>
22
23namespace MaxOS::processes::resources {
24
34 class ProcessResource final : public Resource {
35
36 public:
37 ProcessResource(const string& name, size_t flags, resource_type_t type);
38 ~ProcessResource() final;
39
41 uint64_t exit_code;
42
43 void close(size_t flags) final;
44
45 int read(void* buffer, size_t size, size_t flags) final;
46 int write(const void* buffer, size_t size, size_t flags) final;
47
48 };
49
59 class ThreadResource final : public Resource {
60
61 public:
62 ThreadResource(const string& name, size_t flags, resource_type_t type);
63 ~ThreadResource() final;
64
66 uint64_t exit_code;
67
68
69 void close(size_t flags) final;
70
71 int read(void* buffer, size_t size, size_t flags) final;
72 int write(const void* buffer, size_t size, size_t flags) final;
73 };
74
79 class ThreadResourceRegistry : public ResourceRegistry<ThreadResource> {
80
81 public:
84
85 Resource* get_resource(const string& name) final;
86 Resource* create_resource(const string& name, size_t flags, uintptr_t data) final;
87 };
88
93 class ProcessResourceRegistry : public ResourceRegistry<ProcessResource> {
94
95 public:
98
99 Resource* get_resource(const string& name) final;
100 Resource* create_resource(const string& name, size_t flags, uintptr_t data) final;
101 };
102
103
104}
105
106#endif //MAXOS_PROCESSES_SCHEDULER_RESOURCES_H
A process that can be scheduled by the Scheduler, wraps & manages threads as well as its own address ...
Definition process.h:94
The execution context of a sub-process thread.
Definition process.h:50
Manages the creation, retention and destruction of resources representing processes.
Resource * get_resource(const string &name) final
The.
Resource * create_resource(const string &name, size_t flags, uintptr_t data) final
Opens an executable.
A wrapper for a Process which exposes Process operations as Resource operations.
int write(const void *buffer, size_t size, size_t flags) final
Writes data to the process resource.
Process * process
The process that this resource handles & exposes.
uint64_t exit_code
The exit code of the process once it has exited.
void close(size_t flags) final
Closes the process resource, killing the process and removing it from the scheduler.
int read(void *buffer, size_t size, size_t flags) final
Reads data from the process resource.
A resource registry for a specific resource type.
Definition resource.h:61
Manages the creation, retention and destruction of resources representing threads.
Resource * create_resource(const string &name, size_t flags, uintptr_t data) final
td
Resource * get_resource(const string &name) final
Gets a resource from the registry by name.
A wrapper for a Thread which exposes Thread operations as Resource operations.
void close(size_t flags) final
Closes the thread resource, marking the thread to be removed by the scheduler.
uint64_t exit_code
The exit code of the thread once it has exited.
int read(void *buffer, size_t size, size_t flags) final
Reads data from the thread resource.
int write(const void *buffer, size_t size, size_t flags) final
Writes data to the thread resource.
Thread * thread
The thread that this resource handles & exposes.
Defines Process and Thread classes for managing processes and their execution contexts.
Defines classes for managing process resources such as files and devices.
KPI::Resource Resource
Alias to make the libsyscore Resource accessible here.
Definition resource.h:26
KPI::ResourceType resource_type_t
Alias to make the libsyscore ResourceType accessible here.
Definition resource.h:25