Bläddra i källkod

! untested changes

channel
Ludovic 'Archivist' Lagouardette 3 år sedan
förälder
incheckning
128ac50562
1 ändrade filer med 20 tillägg och 2 borttagningar
  1. +20
    -2
      include/gp/vfs/process_data.hpp

+ 20
- 2
include/gp/vfs/process_data.hpp Visa fil

@ -21,6 +21,16 @@ namespace gp {
using pid_t = size_t;
struct base_process_info {
virtual void initialize() {}
virtual void checkpoint() {}
virtual void restore() {}
virtual void switch_in() {}
virtual void switch_out() {}
virtual void cleanup() {}
virtual ~base_process_info() {}
};
struct process_data{
pid_t pid;
gp::function<void()> fn;
@ -29,14 +39,15 @@ namespace gp {
gp::process_status state;
std::atomic_bool is_running;
[[no_unique_address]] gp::specifics::platform_data specifics;
gp::indexed_array<gp::file_description*, gp_config::limits::max_fd_per_process> fds;
gp::unique_ptr<base_process_info> info;
process_data(gp::function<void()> _fn, void* _stack, size_t _stack_sz)
process_data(gp::function<void()> _fn, void* _stack, size_t _stack_sz, gp::unique_ptr<base_process_info>&& _info)
: fn(_fn)
, stack(_stack)
, stack_sz(_stack_sz)
, state(gp::process_status::inactive)
, specifics(gp::buffer<char>{(char*)stack, stack_sz})
, info(_info)
{}
process_data(process_data&& v)
@ -45,7 +56,14 @@ namespace gp {
, stack_sz(v.stack_sz)
, state(v.state)
, specifics(v.specifics)
, info(gp::move(v.info))
{}
~process_data() {
if(info) {
info->cleanup();
}
}
};
}

Laddar…
Avbryt
Spara